Example usage for org.apache.poi.hssf.usermodel HSSFRow getCell

List of usage examples for org.apache.poi.hssf.usermodel HSSFRow getCell

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFRow getCell.

Prototype

@Override
public HSSFCell getCell(int cellnum) 

Source Link

Document

Get the hssfcell representing a given column (logical cell) 0-based.

Usage

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

/**
 * OSSW_Cover ? /*from w  w w . ja v a  2s .  c  om*/
 * OSSW_Cover written by byunghoon  
 */
public static void ossw_Cover(HSSFWorkbook wb, String CoverDate) {
    LogMaker.makelog("Ex.java Making OSSW_Cover Sheet");
    String Empty = null;

    try {
        HSSFSheet sheet = wb.createSheet("SW ? ");

        HSSFRow row1 = sheet.createRow(1);
        for (int i = 0; i < 20; i++) {
            row1.setHeight((short) 500);
            row1.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row1.getCell(i).setCellStyle(Style.osswCoverCellStyel);
        }

        HSSFRow row2 = sheet.createRow(8);
        row2.setHeight((short) 500);
        row2.createCell(9, HSSFCell.CELL_TYPE_STRING).setCellValue("SW?? ? ");
        row2.getCell(9).setCellStyle(Style.osswCoverCellStyelfont);

        HSSFRow row3 = sheet.createRow(9);
        row3.setHeight((short) 500);
        row3.createCell(9, HSSFCell.CELL_TYPE_STRING).setCellValue(Values.company);
        row3.getCell(9).setCellStyle(Style.osswCoverCellStyelfont);

        HSSFRow row4 = sheet.createRow(16);
        for (int i = 0; i < 20; i++) {
            row4.setHeight((short) 500);
            row4.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row4.getCell(i).setCellStyle(Style.osswCoverCellStyel);
        }

        HSSFRow row5 = sheet.createRow(24);
        row5.setHeight((short) 500);
        row5.createCell(9, HSSFCell.CELL_TYPE_STRING).setCellValue(TimeStamp.getTimeCover());
        row5.getCell(9).setCellStyle(Style.osswCoverCellStyelfont);

        HSSFRow row6 = sheet.createRow(34);
        row6.setHeight((short) 500);
        row6.createCell(9, HSSFCell.CELL_TYPE_STRING).setCellValue("??");
        row6.getCell(9).setCellStyle(Style.osswCoverCellStyelfont);

        HSSFRow row7 = sheet.createRow(35);
        row7.setHeight((short) 500);
        row7.createCell(9, HSSFCell.CELL_TYPE_STRING).setCellValue("SW ?");
        row7.getCell(9).setCellStyle(Style.osswCoverCellStyelfont);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

/**
 * OSSW_Summary ?/*from  ww  w .  ja  v a2 s  .co m*/
 * OSSW_Summary written by byunghoon  
 */
public static void ossw_Summary(HSSFWorkbook wb) {

    LogMaker.makelog("Ex.java Making OSSW_Summary Sheet");
    String Empty = null;

    try {
        HSSFSheet sheet = wb.createSheet("? ? ");

        HSSFRow row1 = sheet.createRow(1);
        row1.setHeight((short) 800);
        row1.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
        row1.getCell(0).setCellStyle(Style.osswSummaryCellStyel_1);
        for (int i = 1; i < 11; i++) {

            row1.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row1.getCell(i).setCellStyle(Style.osswSummaryCellStyel_3);

            if (i == 5) {
                row1.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("? ? ");
                row1.getCell(i).setCellStyle(Style.osswSummaryCellStyel_3);
            }

            if (i == 10) {
                row1.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row1.getCell(i).setCellStyle(Style.osswSummaryCellStyel_2);
            }
        }

        HSSFRow row2 = sheet.createRow(2);
        row2.setHeight((short) 500);
        row2.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue("? ??");
        row2.getCell(0).setCellStyle(Style.osswSummaryCellStyel_5);

        for (int i = 1; i < 11; i++) {

            row2.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row2.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);

            if (i == 3) {
                row2.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Summary.licenseName.getName());
                row2.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);
            }

            if (i == 10) {
                row2.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row2.getCell(i).setCellStyle(Style.osswSummaryCellStyel_6);
            }
        }

        HSSFRow row3 = sheet.createRow(3);
        row3.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue("?? ? ");
        row3.getCell(0).setCellStyle(Style.osswSummaryCellStyel_5);
        row3.setHeight((short) 500);
        for (int i = 1; i < 11; i++) {

            row3.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row3.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);

            if (i == 3) {
                row3.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Summary.files_analyzed + "  Files");
                row3.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);
            }

            if (i == 10) {
                row3.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row3.getCell(i).setCellStyle(Style.osswSummaryCellStyel_6);
            }

        }

        HSSFRow row4 = sheet.createRow(4);
        row4.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue("?? ? ");
        row4.getCell(0).setCellStyle(Style.osswSummaryCellStyel_5);
        row4.setHeight((short) 500);
        for (int i = 1; i < 11; i++) {

            row4.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row4.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);

            if (i == 3) {
                row4.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(
                        Summary.kibytes_analyzed + " KiB" + " (" + Summary.bytes_analyzed + " bytes)");
                row4.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);
            }

            if (i == 10) {
                row4.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row4.getCell(i).setCellStyle(Style.osswSummaryCellStyel_6);
            }
        }

        HSSFRow row5 = sheet.createRow(5);
        row5.setHeight((short) 500);
        row5.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue("?? ? ");
        row5.getCell(0).setCellStyle(Style.osswSummaryCellStyel_5);
        for (int i = 1; i < 11; i++) {

            row5.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row5.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);

            if (i == 3) {
                row5.createCell(i, HSSFCell.CELL_TYPE_STRING)
                        .setCellValue(Summary.id_required_files + " Files");
                row5.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);
            }

            if (i == 10) {
                row5.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row5.getCell(i).setCellStyle(Style.osswSummaryCellStyel_6);
            }
        }

        HSSFRow row6 = sheet.createRow(6);
        row6.setHeight((short) 500);
        row6.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue("SW ? ");
        row6.getCell(0).setCellStyle(Style.osswSummaryCellStyel_5);
        for (int i = 1; i < 11; i++) {

            row6.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row6.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);

            if (i == 3) {
                row6.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Summary.oss_files + " Files" + " ( "
                        + String.format("%.2f", Summary.oss_files_percent) + "% )");
                row6.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);
            }

            if (i == 10) {
                row6.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row6.getCell(i).setCellStyle(Style.osswSummaryCellStyel_6);
            }
        }

        HSSFRow row7 = sheet.createRow(7);
        row7.setHeight((short) 500);
        row7.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue(" ? ? ");
        row7.getCell(0).setCellStyle(Style.osswSummaryCellStyel_5);
        for (int i = 1; i < 11; i++) {

            row7.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row7.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);

            if (i == 3) {
                row7.createCell(i, HSSFCell.CELL_TYPE_STRING)
                        .setCellValue(Summary.attention_conflict_files + " Files" + " ( "
                                + String.format("%.2f", Summary.attention_conflict_files_percent) + "% )");
                row7.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);
            }

            if (i == 10) {
                row7.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row7.getCell(i).setCellStyle(Style.osswSummaryCellStyel_6);
            }
        }

        HSSFRow row8 = sheet.createRow(8);
        row8.setHeight((short) 500);
        row8.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue("  ? ");
        row8.getCell(0).setCellStyle(Style.osswSummaryCellStyel_5);

        for (int i = 1; i < 11; i++) {

            row8.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
            row8.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);

            if (i == 3) {
                row8.createCell(i, HSSFCell.CELL_TYPE_STRING)
                        .setCellValue(Summary.violation_conflict_files + " Files" + " ( "
                                + String.format("%.2f", Summary.violation_conflict_files_percent) + "% )");
                row8.getCell(i).setCellStyle(Style.osswSummaryCellStyel_4);
            }

            if (i == 10) {
                row8.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(Empty);
                row8.getCell(i).setCellStyle(Style.osswSummaryCellStyel_6);
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

/**
 * OSSW_BOM written by byunghoon// w w  w. ja  v a 2  s .  c o  m
 *  
 */
public static void ossw_BOM(HSSFWorkbook wb) {

    LogMaker.makelog("Ex.java Making OSSW_BOM Sheet");
    String Empty = null;

    try {
        HSSFSheet sheet = wb.createSheet("?  ?(Bill of Materials");

        HSSFRow row1 = sheet.createRow(1);
        row1.setHeight((short) 800);
        row1.createCell(0, HSSFCell.CELL_TYPE_STRING).setCellValue(" ");
        row1.getCell(0).setCellStyle(Style.osswBOMCellStyel_1);
        sheet.setColumnWidth(0, 7000);
        row1.createCell(1, HSSFCell.CELL_TYPE_STRING).setCellValue("?");
        row1.getCell(1).setCellStyle(Style.osswBOMCellStyel_1);
        sheet.setColumnWidth(1, 7000);
        row1.createCell(2, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row1.getCell(2).setCellStyle(Style.osswBOMCellStyel_1);
        sheet.setColumnWidth(2, 7000);
        row1.createCell(3, HSSFCell.CELL_TYPE_STRING).setCellValue("?");
        row1.getCell(3).setCellStyle(Style.osswBOMCellStyel_1);
        sheet.setColumnWidth(3, 15000);
        row1.createCell(4, HSSFCell.CELL_TYPE_STRING).setCellValue("??");
        row1.getCell(4).setCellStyle(Style.osswBOMCellStyel_1);
        sheet.setColumnWidth(4, 7000);
        row1.createCell(5, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row1.getCell(5).setCellStyle(Style.osswBOMCellStyel_1);
        sheet.setColumnWidth(5, 7000);
        row1.createCell(6, HSSFCell.CELL_TYPE_STRING).setCellValue("? ");
        row1.getCell(6).setCellStyle(Style.osswBOMCellStyel_1);
        sheet.setColumnWidth(6, 7000);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

/**
  *///from   w ww.j ava  2 s  .  c  o m
public static void setOneLineHeader(HSSFSheet sheet, int iRowNum, ArrayList<String> al) {
    LogMaker.makelog("Creating Header in Excel");
    try {
        HSSFRow row = sheet.createRow(iRowNum);
        row.setHeight((short) 600);
        int i = 0;
        for (String str : al) {
            row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(str);
            if (i == 1) {
                row.getCell(i).setCellStyle(Style.finalHeaderCellStyle);

                CellRangeAddressList addressList = new CellRangeAddressList(0, 0, 1, 1);
                DVConstraint dvConstraint = DVConstraint
                        .createExplicitListConstraint(new String[] { "A", "B" });
                DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                dataValidation.setSuppressDropDownArrow(false);
                sheet.addValidationData(dataValidation);

            } else if (i == 2) {
                row.getCell(i).setCellStyle(Style.finalHeaderCellStyle);

                CellRangeAddressList addressList = new CellRangeAddressList(0, 0, i, i);
                DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint(
                        new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
                DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                dataValidation.setSuppressDropDownArrow(false);
                sheet.addValidationData(dataValidation);

            } else if (i == 3) {
                row.getCell(i).setCellStyle(Style.finalHeaderCellStyle);

                CellRangeAddressList addressList = new CellRangeAddressList(0, 0, i, i);
                DVConstraint dvConstraint = DVConstraint
                        .createExplicitListConstraint(new String[] { "A", "B", "C", "D", "E" });
                DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                dataValidation.setSuppressDropDownArrow(false);
                sheet.addValidationData(dataValidation);

            }

            else {
                try {
                    row.getCell(i).setCellStyle(Style.finalHeaderCellStyle);

                } catch (NullPointerException e) {
                    e.printStackTrace();

                }

            }

            sheet.autoSizeColumn((short) i, true);
            i++;

        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

public static void src2ndrow(HSSFSheet sheet, ArrayList<String> al, int i, HSSFRow row, int a, int b) {

    try {//from   w  w w  .  j a  va  2 s.co m

        //HSSFRow row = sheet.createRow(iRowNum); 
        row.setHeight((short) 500);
        for (String str : al) {
            row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue(str);
            //row.getCell(20).setCellStyle(Style.src2ndrowFinalCellStyle);
            if (i < a && i >= 0) {
                row.getCell(i).setCellStyle(Style.src2ndrowCellStyle);
            } else if (i < b && i >= a) {
                row.getCell(i).setCellStyle(Style.src2ndrowMidCellStyle);
            } else if (i >= b) {
                row.getCell(i).setCellStyle(Style.src2ndrowFinalCellStyle);
            }

            //if(!al.equals("                       ")){
            //"                       "
            //sheet.autoSizeColumn((short)i, true);//bia autosize
            //}

            if (al.equals("Person In Charge")) {
                sheet.autoSizeColumn((short) i, true);
            }

            i++;

        }
        //row.getCell(20).setCellStyle(Style.src2ndrowFinalCellStyle);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

@SuppressWarnings("unchecked")

public static void srcPr(HSSFSheet srcSheet) {
    LogMaker.makelog("prepare to Print ID File info to Excel sheet");

    //category /*from w  w w.ja va 2s. c om*/
    String[] strCategory = new String[FileVals.category.size()];
    FileVals.category.toArray(strCategory);

    String[] strFPath = new String[FileVals.fPath.size()];
    FileVals.fPath.toArray(strFPath);

    String[] strDType = new String[FileVals.dtype.size()];
    FileVals.dtype.toArray(strDType);

    String[] strFileFolder = new String[FileVals.file.size()];
    FileVals.file.toArray(strFileFolder);

    String[] strComponent = new String[FileVals.component.size()];
    FileVals.component.toArray(strComponent);

    String[] strLicense = new String[FileVals.license.size()];
    FileVals.license.toArray(strLicense);

    String[] strVersion = new String[FileVals.version.size()];
    FileVals.version.toArray(strVersion);

    //matched files
    String[] strOSSFname = new String[FileVals.OSSFname.size()];
    FileVals.OSSFname.toArray(strOSSFname);

    String[] strPercent = new String[FileVals.matchedRatio.size()];
    FileVals.matchedRatio.toArray(strPercent);

    //OSS matched file line
    String[] strOSSFLine = new String[FileVals.OSSFLine.size()];
    FileVals.OSSFLine.toArray(strOSSFLine);

    //Dev Matched First Line
    String[] strFirstLine = new String[FileVals.firstLine.size()];
    FileVals.firstLine.toArray(strFirstLine);

    //matched total line
    String[] strTotalLine = new String[FileVals.tline.size()];
    FileVals.tline.toArray(strTotalLine);

    //identified date
    String[] strIdentifiedDate = new String[FileVals.identifiedDate.size()];
    FileVals.identifiedDate.toArray(strIdentifiedDate);

    //identifier
    String[] strIdentifier = new String[FileVals.identifier.size()];
    FileVals.identifier.toArray(strIdentifier);

    String[] strComment = new String[FileVals.comment.size()];
    FileVals.comment.toArray(strComment);

    int partialCount = Count.partialCount;
    //int partialCount=0;
    LogMaker.makelog("Printing File Info to excel");
    for (int i = 0; i < strDType.length; i++) {
        //HSSFRow tempRow = srcSheet.createRow(i+2+iCount-(lineCount-1));//???
        HSSFRow tempRow = srcSheet.createRow(i + 2 + Count.partialCount);//???
        partialCount++;

        tempRow.setHeight((short) 500);

        String a = (strFileFolder[i].substring(1));

        // category print
        int c = 0;

        try {
            tempRow.createCell(c).setCellValue(a.substring(0, a.indexOf("/")));
            //if (strCate.equals(a.substring(0,a.indexOf("/")))){}

        } catch (Exception e) {
            tempRow.createCell(c).setCellValue(a);
        }

        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        tempRow.createCell(c).setCellValue(a);
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //Identification type print
        tempRow.createCell(c).setCellValue(strDType[i]);
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        tempRow.createCell(c).setCellValue(strComponent[i]);
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //License Print
        tempRow.createCell(c).setCellValue(strLicense[i]);
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //version Print
        tempRow.createCell(c).setCellValue(strVersion[i]);
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //OSS matched Files;OSS matched Filename; print
        try {
            tempRow.createCell(c).setCellValue(strOSSFname[i]);
        } catch (Exception e) {
            tempRow.createCell(c).setCellValue("");
        }
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //matched percent print;
        if (strPercent[i] == "" || strPercent[i] == null) {
            tempRow.createCell(c).setCellValue("100%");
        } else {
            tempRow.createCell(c).setCellValue(strPercent[i] + "%");
        }
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //OSS file line print
        try {
            tempRow.createCell(c).setCellValue(strOSSFLine[i]);
        } catch (Exception e) {
            tempRow.createCell(c).setCellValue("");
        }
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //Dev Matched First Line print
        try {
            tempRow.createCell(c).setCellValue(strFirstLine[i]);
        } catch (Exception e) {
            tempRow.createCell(c).setCellValue("");
        }
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //Dev Matched Total Line print
        try {
            tempRow.createCell(c).setCellValue(strTotalLine[i]);
        } catch (Exception e) {
            tempRow.createCell(c).setCellValue("");
        }
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //Identified Date; identifieddate;
        try {
            tempRow.createCell(c).setCellValue(strIdentifiedDate[i]);
        } catch (Exception e) {
            tempRow.createCell(c).setCellValue("");
        }
        //tempRow.createCell(c).setCellValue(strIdentifiedDate[i]);
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //Identifier print
        try {
            tempRow.createCell(c).setCellValue(strIdentifier[i]);
        } catch (Exception e) {
            tempRow.createCell(c).setCellValue("");
        }

        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //Comment print
        tempRow.createCell(c).setCellValue(strComment[i]);
        tempRow.getCell(c).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) c, true);
        c++;

        //other empty cell
        for (int temp = c; temp < 21; temp++) {
            tempRow.createCell(temp).setCellValue("");
            tempRow.getCell(temp).setCellStyle(Style.componentCellStyle);
            //srcSheet.autoSizeColumn((short) c, true);
            if (temp == 16) {
                //CellRangeAddressList(startRow, endRow, startCol, endCol)
                CellRangeAddressList addressList = new CellRangeAddressList(i + 2, i + 2, temp, temp);
                DVConstraint dvConstraint = DVConstraint
                        .createExplicitListConstraint(new String[] { "A", "B" });
                DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                dataValidation.setSuppressDropDownArrow(false);
                srcSheet.addValidationData(dataValidation);
            }
            if (temp == 15) {
                //CellRangeAddressList(startRow, endRow, startCol, endCol)
                CellRangeAddressList addressList = new CellRangeAddressList(i + 2, i + 2, temp, temp);
                DVConstraint dvConstraint = DVConstraint
                        .createExplicitListConstraint(new String[] { "A", "B", "C", "D", "E" });
                DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                dataValidation.setSuppressDropDownArrow(false);
                srcSheet.addValidationData(dataValidation);
            }

            //c++;   
        }

        //tempRow.createCell(3).setCellValue(strComponent[i]+" (+"+(compCount-1)+")");
        tempRow.createCell(3).setCellValue(strComponent[i] + " (+0)");
        tempRow.getCell(3).setCellStyle(Style.componentCellStyle);
        srcSheet.autoSizeColumn((short) 3, true);

        FileVals.clearAllArrayList();
    }

    Count.partialCount = partialCount;

}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

public static void cover(HSSFWorkbook wb) {
    LogMaker.makelog("Making Cover sheet");
    HSSFSheet sheet = wb.createSheet("Cover");// ??????? 

    for (int iRowNum = 0; iRowNum < 1; iRowNum++) {///////1??
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 2;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Date      ");
        row.getCell(iCol).setCellStyle(Style.dateCellStyle);
        sheet.autoSizeColumn((short) iCol, true);
        iCol++;/*from w w w.  j av a2 s.co  m*/

        row.createCell(iCol);
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("            ");
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Doc. No.           ");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Version");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol);
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("              ");
        row.getCell(iCol).setCellStyle(Style.leftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
    }

    for (int iRowNum = 1; iRowNum < 2; iRowNum++) {//2??
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue(" EXAMPLE     ");
        row.getCell(iCol).setCellStyle(Style.exampleCellStyle);
        sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("               ");
        row.getCell(iCol).setCellStyle(Style.exbCellStyle);
        iCol++;

        row.createCell(iCol);
        row.getCell(iCol).setCellStyle(Style.dateCellStyle);
        iCol++;

        row.createCell(iCol);
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        iCol++;

        row.createCell(iCol);
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        iCol++;

        row.createCell(iCol);
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        iCol++;

        row.createCell(iCol);
        row.getCell(iCol).setCellStyle(Style.leftOpenMediumRightCellStyle);
        iCol++;
    }

    for (int iRowNum = 2; iRowNum < 3; iRowNum++) {//3??
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Organization");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Author");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Reviewer");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Approver");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }

    for (int iRowNum = 3; iRowNum < 4; iRowNum++) {//4th row
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        row.setHeight((short) 500);
        iCol++;

        row.createCell(iCol);
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }

    for (int iRowNum = 4; iRowNum < 5; iRowNum++) {//5th row
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Project");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Title");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.LROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.LROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.LROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }

    for (int iRowNum = 5; iRowNum < 6; iRowNum++) {//6th row
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BRightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        row.setHeight((short) 500);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLeftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BRightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLeftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }
    //////////////////////////example end

    for (int iRowNum = 7; iRowNum < 8; iRowNum++) {//8th row

        HSSFRow row = sheet.createRow(iRowNum);

        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Project Information");
        row.getCell(iCol).setCellStyle(Style.projectInformationCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

    }

    for (int iRowNum = 8; iRowNum < 9; iRowNum++) {//9th row

        HSSFRow row = sheet.createRow(iRowNum);

        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.TLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.TLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        row.setHeight((short) 400);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.TLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.TLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.TleftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.TrightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.TleftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);

        iCol++;

    }

    for (int iRowNum = 9; iRowNum < 18; iRowNum++) {//10-18th row
        HSSFRow row = sheet.createRow(iRowNum);

        row.setHeight((short) 350);

        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.LROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.LROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.LROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.LROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.rightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.leftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }

    for (int iRowNum = 18; iRowNum < 19; iRowNum++) {//19th row
        HSSFRow row = sheet.createRow(iRowNum);

        row.setHeight((short) 350);

        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLROpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLeftOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BRightOpenCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.BLeftOpenMediumRightCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }
    for (int iRowNum = 20; iRowNum < 21; iRowNum++) {//21th row
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Change History");
        row.getCell(iCol).setCellStyle(Style.CHCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }

    for (int iRowNum = 21; iRowNum < 22; iRowNum++) {//22th row
        HSSFRow row = sheet.createRow(iRowNum);
        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Version");
        row.getCell(iCol).setCellStyle(Style.greyCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Date");
        row.getCell(iCol).setCellStyle(Style.greyCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Description");
        row.getCell(iCol).setCellStyle(Style.greyCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.greyCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.greyCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("Author");
        row.getCell(iCol).setCellStyle(Style.greyCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("OSS Notice Version");
        row.getCell(iCol).setCellStyle(Style.greyCellStyle);
        sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }

    for (int iRowNum = 22; iRowNum < 44; iRowNum++) {//23-44th row
        HSSFRow row = sheet.createRow(iRowNum);

        row.setHeight((short) 400);

        int iCol = 0;
        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;

        row.createCell(iCol, HSSFCell.CELL_TYPE_STRING).setCellValue("");
        row.getCell(iCol).setCellStyle(Style.componentCellStyle);
        //sheet.autoSizeColumn((short) iCol, true);
        iCol++;
    }

    //////////merge cell
    //?????? sheet.AddMergedRegion(int ????row, short ????col,int ????row, short ????col);
    //example
    sheet.addMergedRegion(new Region(1, (short) 0, 1, (short) 1));
    sheet.addMergedRegion(new Region(0, (short) 2, 0, (short) 3));
    sheet.addMergedRegion(new Region(0, (short) 5, 0, (short) 6));
    sheet.addMergedRegion(new Region(1, (short) 2, 1, (short) 3));
    sheet.addMergedRegion(new Region(1, (short) 5, 1, (short) 6));
    sheet.addMergedRegion(new Region(2, (short) 0, 2, (short) 1));
    sheet.addMergedRegion(new Region(2, (short) 2, 2, (short) 3));
    sheet.addMergedRegion(new Region(2, (short) 5, 2, (short) 6));
    sheet.addMergedRegion(new Region(3, (short) 5, 3, (short) 6));
    sheet.addMergedRegion(new Region(3, (short) 0, 3, (short) 1));
    sheet.addMergedRegion(new Region(3, (short) 2, 3, (short) 3));
    sheet.addMergedRegion(new Region(4, (short) 0, 4, (short) 1));
    sheet.addMergedRegion(new Region(4, (short) 2, 4, (short) 6));
    sheet.addMergedRegion(new Region(5, (short) 0, 5, (short) 1));
    sheet.addMergedRegion(new Region(5, (short) 2, 5, (short) 6));

    //project information
    sheet.addMergedRegion(new Region(8, (short) 0, 8, (short) 4));
    sheet.addMergedRegion(new Region(8, (short) 5, 8, (short) 6));
    sheet.addMergedRegion(new Region(9, (short) 0, 9, (short) 4));
    sheet.addMergedRegion(new Region(9, (short) 5, 9, (short) 6));
    sheet.addMergedRegion(new Region(10, (short) 0, 10, (short) 4));
    sheet.addMergedRegion(new Region(10, (short) 5, 10, (short) 6));
    sheet.addMergedRegion(new Region(11, (short) 0, 11, (short) 4));
    sheet.addMergedRegion(new Region(11, (short) 5, 11, (short) 6));
    sheet.addMergedRegion(new Region(12, (short) 0, 12, (short) 4));
    sheet.addMergedRegion(new Region(12, (short) 5, 12, (short) 6));
    sheet.addMergedRegion(new Region(13, (short) 0, 13, (short) 4));
    sheet.addMergedRegion(new Region(13, (short) 5, 13, (short) 6));
    sheet.addMergedRegion(new Region(14, (short) 0, 14, (short) 4));
    sheet.addMergedRegion(new Region(14, (short) 5, 14, (short) 6));
    sheet.addMergedRegion(new Region(15, (short) 0, 15, (short) 4));
    sheet.addMergedRegion(new Region(15, (short) 5, 15, (short) 6));
    sheet.addMergedRegion(new Region(16, (short) 0, 16, (short) 4));
    sheet.addMergedRegion(new Region(16, (short) 5, 16, (short) 6));
    sheet.addMergedRegion(new Region(17, (short) 0, 17, (short) 4));
    sheet.addMergedRegion(new Region(17, (short) 5, 17, (short) 6));
    sheet.addMergedRegion(new Region(18, (short) 0, 18, (short) 4));
    sheet.addMergedRegion(new Region(18, (short) 5, 18, (short) 6));

    //change history
    for (int i = 21; i < 44; i++) {
        sheet.addMergedRegion(new Region(i, (short) 2, i, (short) 4));
    }

}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

/**
 * "src_Project_Name"  //from www  .  ja  v  a2 s .co m
 * 
 */

public static void src(HSSFWorkbook wb, String projectName) {
    LogMaker.makelog("Making sheet for Project ID Files");

    HSSFSheet sheet;
    projectName = SCharRemover.StringReplace(projectName, false);
    int pCount = 0;
    sheet = wb.createSheet("SRC_" + projectName);

    Count.sheet = sheet;

    ArrayList<String> Header = new ArrayList<String>();

    for (int rowNum = 0; rowNum < 1; rowNum++) {
        HSSFRow row = sheet.createRow(0);
        row.setHeight((short) 500);
        int i = 0;
        row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Description");
        row.getCell(i).setCellStyle(Style.anaDesCellStyle);

        sheet.autoSizeColumn((short) i, true);
        i++;

        row.createCell(14, HSSFCell.CELL_TYPE_STRING).setCellValue("1st Review (Development Team)");
        row.getCell(14).setCellStyle(Style.fReviewCellStyle);
        i++;

        row.createCell(19, HSSFCell.CELL_TYPE_STRING).setCellValue("Final Review");
        row.getCell(19).setCellStyle(Style.finalReviewCellStyle);
        i++;

    }

    sheet.addMergedRegion(new Region(0, (short) 0, 0, (short) 13));
    sheet.addMergedRegion(new Region(0, (short) 14, 0, (short) 18));
    sheet.addMergedRegion(new Region(0, (short) 19, 0, (short) 20));

    Header.clear();

    Header.add("Category");
    Header.add("File Path");
    Header.add("Identification Type");
    Header.add("Component");
    Header.add("License");
    Header.add("Version");
    Header.add("OSS: Matched Files");
    Header.add("%");
    Header.add("OSS: Matched File Line");
    Header.add("Dev.: Matched First Line");
    Header.add("Dev.: Matched Total Line");
    Header.add("Identified Date");
    Header.add("Identifier");
    Header.add("Comments");

    HSSFRow row = sheet.createRow(1);
    row.setHeight((short) 500);
    src2ndrow(sheet, Header, 0, row, 14, 19);

    Header.clear();

    Header.add("           Person In Charge           ");
    Header.add("              Linkage Type            ");
    Header.add("                A or B                ");
    Header.add("          Reviewer's Comments         ");
    Header.add("             Counterplan              ");

    src2ndrow(sheet, Header, 14, row, 14, 19);// 0?? ???? ??????? 

    Header.clear();

    Header.add("           Final Review Date           ");
    Header.add("          Reviewer's Comments          ");

    src2ndrow(sheet, Header, 19, row, 14, 19);
    for (int i = 14; i < 21; i++) {
        sheet.autoSizeColumn(i, true);
    }

}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

/**
 * "Build Image Analysis"  //from ww w .j  av a 2  s. c o m
 *      * 
 */

public static void lineHeader(HSSFSheet sheet, int iRowNum, ArrayList<String> al) {

    LogMaker.makelog("Creating Header Info");
    HSSFRow row = sheet.createRow(0);
    row.setHeight((short) 500);

    int i = 0;
    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Description");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("a                  a");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Deion");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Description");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Dion");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis D    escription");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(6, HSSFCell.CELL_TYPE_STRING).setCellValue("1st Review (Development Team)");
    row.getCell(6).setCellStyle(Style.fReviewCellStyle);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Don");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Descrition");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(9, HSSFCell.CELL_TYPE_STRING).setCellValue("Final Review       ");
    row.getCell(9).setCellStyle(Style.finalReviewCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

    row.createCell(i, HSSFCell.CELL_TYPE_STRING).setCellValue("Analysis Description");
    row.getCell(i).setCellStyle(Style.anaDesCellStyle);

    sheet.autoSizeColumn((short) i, true);
    i++;

}

From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java

License:Open Source License

/**
 * "Build Image Analysis"  /*w w  w .j ava  2s  .c  om*/
 *      * 
 */

public static void BIA(HSSFWorkbook wb) {
    LogMaker.makelog("Making BIA sheet");
    HSSFSheet sheetBIA = wb.createSheet("Build Image Analysis");// ??????? 

    ArrayList<String> Header = new ArrayList<String>();

    Header.add("Analysis Description");
    Header.add("1st Reviewer (Development Team)");
    Header.add("Final Revewer");

    lineHeader(sheetBIA, 0, Header);// 0?? ???? ??????? 
    sheetBIA.addMergedRegion(new Region(0, (short) 0, 0, (short) 5));
    sheetBIA.addMergedRegion(new Region(0, (short) 6, 0, (short) 8));
    sheetBIA.addMergedRegion(new Region(0, (short) 9, 0, (short) 10));
    Header.clear();

    HSSFRow row = sheetBIA.createRow(1); //row ????
    row.setHeight((short) 500);
    Header.add("Binary File Path");
    Header.add("                ");
    Header.add("Component");
    Header.add("License");//drop down
    Header.add("Analyzer");
    Header.add("Analyzer's Comments");

    src2ndrow(sheetBIA, Header, 0, row, 6, 9);
    Header.clear();
    sheetBIA.addMergedRegion(new Region(1, (short) 0, 1, (short) 1));

    Header.add("Person In Charge");
    Header.add("A or B");//drop down
    Header.add("Reviewer's Ccomments");

    src2ndrow(sheetBIA, Header, 6, row, 6, 9);// 0?? ???? ??????? 
    sheetBIA.autoSizeColumn((short) 6, true);
    sheetBIA.autoSizeColumn((short) 8, true);
    Header.clear();

    Header.add("Review Date");
    Header.add("Reviewer's Comments");

    src2ndrow(sheetBIA, Header, 9, row, 6, 9);// 0?? ???? ??????? 
    Header.clear();

    for (int i = 2; i < 200; i++) {
        HSSFRow row2 = sheetBIA.createRow(i);
        row2.setHeight((short) 500);
        for (int j = 0; j < 11; j++) {
            row2.createCell(j, HSSFCell.CELL_TYPE_STRING).setCellValue("           ");
            row2.getCell(j).setCellStyle(Style.componentCellStyle);

            if (j == 3) {
                CellRangeAddressList addressList = new CellRangeAddressList(i, i, j, j);
                DVConstraint dvConstraint = DVConstraint
                        .createExplicitListConstraint(new String[] { "A", "B" });
                DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                dataValidation.setSuppressDropDownArrow(false);
                sheetBIA.addValidationData(dataValidation);
            }

            if (j == 7) {
                CellRangeAddressList addressList = new CellRangeAddressList(i, i, j, j);
                DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint(
                        new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
                DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint);
                dataValidation.setSuppressDropDownArrow(false);
                sheetBIA.addValidationData(dataValidation);
            }
        }
    }

}