List of usage examples for org.apache.poi.hssf.usermodel HSSFRow setHeight
@Override public void setHeight(short height)
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 {/* www.j a v a 2 s . c o 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 /*ww w . ja v a 2 s. c o m*/ 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 ava 2s.c o 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 w ww.j a v a 2 s . c o 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" /* ww w . j a v a2 s . c om*/ * * */ 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 ww . ja va 2 s . com * * */ 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); } } } }
From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java
License:Open Source License
/** * "OSS Check List sheet" //from w ww . j a v a 2 s . com * */ public static void OSSCLineHeader(HSSFSheet sheet) { LogMaker.makelog("Creating OSS Header"); 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("Analysis vv Description"); 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(3, HSSFCell.CELL_TYPE_STRING).setCellValue("1st Review (Development Team) "); row.getCell(3).setCellStyle(Style.fReviewCellStyle); 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(5, HSSFCell.CELL_TYPE_STRING).setCellValue(" Final Review "); row.getCell(5).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
/** * "OSS Check List sheet" //w ww. j av a 2s . c o m * */ public static void OSSC(HSSFWorkbook wb) { LogMaker.makelog("Making OSS Sheet"); HSSFSheet sheet = wb.createSheet("OSS Checklist");// ??????? ArrayList<String> Header = new ArrayList<String>(); OSSCLineHeader(sheet);// 0?? ???? ??????? //Header.clear(); Header.add("3rd Party Name"); Header.add("Checklist File"); Header.add("Analyzer's Comments");//drop down HSSFRow row = sheet.createRow(1); row.setHeight((short) 500); //src2ndrow(HSSFSheet sheet, ArrayList<String> al,int i,HSSFRow row, int a, int b) src2ndrow(sheet, Header, 0, row, 3, 5); Header.clear(); Header.add("Person In Charge"); Header.add("Reviewer's Ccomments"); src2ndrow(sheet, Header, 3, row, 3, 5); Header.clear(); Header.add("Review Date"); Header.add("Reviewer's Comments"); src2ndrow(sheet, Header, 5, row, 3, 5); Header.clear(); sheet.addMergedRegion(new Region(0, (short) 0, 0, (short) 2)); sheet.addMergedRegion(new Region(0, (short) 3, 0, (short) 4)); sheet.addMergedRegion(new Region(0, (short) 5, 0, (short) 6)); //?? ???? for (int i = 2; i < 200; i++) { HSSFRow row2 = sheet.createRow(i); row2.setHeight((short) 800); for (int j = 0; j < 7; j++) { row2.createCell(j, HSSFCell.CELL_TYPE_STRING).setCellValue(""); row2.getCell(j).setCellStyle(Style.componentCellStyle); } } }
From source file:kr.co.blackducksoftware.rg.displayexcel.Ex.java
License:Open Source License
/** * "Final List" // w w w . j ava 2 s . c om * */ public static void FL(HSSFWorkbook wb) { LogMaker.makelog("Making Final sheet"); HSSFSheet sheet = wb.createSheet("Final List");// ??????? ArrayList<String> Header = new ArrayList<String>(); Header.add(" Component Name "); Header.add(" A or B "); //Drop down Header.add(" License "); //Drop Down Header.add(" Linkage Type "); //Drop down Header.add(" License Copy "); Header.add(" Remark "); // Macro ? ??? setOneLineHeader(sheet, 0, Header);// 0?? ???? ??????? Header.clear(); //?? ???? for (int i = 1; i < 200; i++) { HSSFRow row2 = sheet.createRow(i); row2.setHeight((short) 500); for (int j = 0; j < 6; j++) { row2.createCell(j, HSSFCell.CELL_TYPE_STRING).setCellValue(""); row2.getCell(j).setCellStyle(Style.componentCellStyle); if (j == 1) { //CellRangeAddressList(startRow, endRow, startCol, endCol) CellRangeAddressList addressList = new CellRangeAddressList(i, i, 1, 1); DVConstraint dvConstraint = DVConstraint .createExplicitListConstraint(new String[] { "A", "B" }); DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint); dataValidation.setSuppressDropDownArrow(false); sheet.addValidationData(dataValidation); } if (j == 2) { //CellRangeAddressList(startRow, endRow, startCol, endCol) 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); sheet.addValidationData(dataValidation); } if (j == 3) { //CellRangeAddressList(startRow, endRow, startCol, endCol) CellRangeAddressList addressList = new CellRangeAddressList(i, i, j, j); DVConstraint dvConstraint = DVConstraint .createExplicitListConstraint(new String[] { "A", "B", "C", "D", "E" }); DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint); dataValidation.setSuppressDropDownArrow(false); sheet.addValidationData(dataValidation); } } } }
From source file:mx.avanti.siract.ui.FiltrosBeanUI.java
public void Export2ExcelSemaforoProgramasEd() throws Throwable { //variables listaux ReporteAux reporteUI = new ReporteAux(); // objeto de hoja de excel HSSFWorkbook workbook = new HSSFWorkbook(); String nombreLibro = ""; //guardamos imagen UABC en Documento URL location = FiltrosBeanUI.class.getProtectionDomain().getCodeSource().getLocation(); String path = location.getFile(); String replace = path.replace("FiltrosBeanUI.class", "uabclogo.png"); //InputStream uabc_image = new FileInputStream(replace); //InputStream uabc_image = new FileInputStream("C://decode/uabclogo.png"); InputStream uabc_image = new FileInputStream("/home/user/decode/uabclogo.png"); byte[] bytes = IOUtils.toByteArray(uabc_image); int uabcLogo = workbook.addPicture(bytes, Workbook.PICTURE_TYPE_PNG); uabc_image.close();/*w w w . j a v a 2 s .c o m*/ //definimos estilo a celda titulo de los encabezados con logo escuela HSSFCellStyle style = workbook.createCellStyle(); HSSFFont font = workbook.createFont(); font.setFontName(HSSFFont.FONT_ARIAL); font.setFontHeightInPoints((short) 20); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); font.setColor(HSSFColor.GREEN.index); style.setFont(font); //setCellStyle(style); //definimos los bordes de celdas en tabla HSSFCellStyle borderstabla = workbook.createCellStyle(); borderstabla.setBorderBottom(HSSFCellStyle.BORDER_THIN); borderstabla.setBorderTop(HSSFCellStyle.BORDER_THIN); borderstabla.setBorderRight(HSSFCellStyle.BORDER_THIN); borderstabla.setBorderLeft(HSSFCellStyle.BORDER_THIN); font = workbook.createFont(); borderstabla.setFont(font); //definimos el estilo de las cabezeras de una tabla HSSFCellStyle headerTabla = workbook.createCellStyle(); HSSFFont fontwit = workbook.createFont(); fontwit.setColor(HSSFColor.WHITE.index); headerTabla.setBorderBottom(HSSFCellStyle.BORDER_THIN); headerTabla.setBorderTop(HSSFCellStyle.BORDER_THIN); headerTabla.setBorderRight(HSSFCellStyle.BORDER_THIN); headerTabla.setBorderLeft(HSSFCellStyle.BORDER_THIN); headerTabla.setFillForegroundColor(HSSFColor.GREEN.index); headerTabla.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); headerTabla.setFont(fontwit); //aqui cambie headerTabla.setWrapText(true); //aqui cambie //if(criterio.equalsIgnoreCase("programa_educativo")){ HSSFSheet sheet = workbook.createSheet("Programas Educativos"); nombreLibro = "- Director"; // if(reporte.equalsIgnoreCase("entregados")){ nombreLibro = "RACT General " + nombreLibro; //definimos encabezado sheet = cabezeraGeneralExcel(sheet, uabcLogo, style); HSSFRow row1 = sheet.createRow(7); row1.setHeight((short) 600); HSSFCell cell = row1.createCell(1); cell.setCellValue( "Concentrado de Reporte de Avance de Contenido Temtico General por Programa Educativo"); cell.setCellStyle(style); // HSSFRow row1 = sheet.createRow(14); // row1.setHeightInPoints(56); // HSSFRow row2 = sheet.createRow(28); // row2.setHeightInPoints(56); // HSSFRow row3 = sheet.createRow(42); // row3.setHeightInPoints(56); //aqui cambie jesus ruelas //for(int i=0;i<28;i++){ // sheet.autoSizeColumn(1); // sheet.autoSizeColumn(2); // sheet.autoSizeColumn(3); // sheet.autoSizeColumn(4); //merge cells de Total de RACT General de + ProgEd sheet.addMergedRegion(new CellRangeAddress(13, 13, 1, 5)); sheet.addMergedRegion(new CellRangeAddress(13, 13, 7, 11)); sheet.addMergedRegion(new CellRangeAddress(13, 13, 13, 17)); sheet.addMergedRegion(new CellRangeAddress(13, 13, 19, 23)); sheet.addMergedRegion(new CellRangeAddress(13, 13, 25, 29)); sheet.addMergedRegion(new CellRangeAddress(27, 27, 1, 5)); sheet.addMergedRegion(new CellRangeAddress(27, 27, 7, 11)); sheet.addMergedRegion(new CellRangeAddress(27, 27, 13, 17)); sheet.addMergedRegion(new CellRangeAddress(27, 27, 19, 23)); sheet.addMergedRegion(new CellRangeAddress(27, 27, 25, 29)); sheet.addMergedRegion(new CellRangeAddress(41, 41, 1, 5)); sheet.addMergedRegion(new CellRangeAddress(41, 41, 7, 11)); sheet.addMergedRegion(new CellRangeAddress(41, 41, 13, 17)); sheet.addMergedRegion(new CellRangeAddress(41, 41, 19, 23)); sheet.addMergedRegion(new CellRangeAddress(41, 41, 25, 29)); sheet.addMergedRegion(new CellRangeAddress(55, 55, 1, 5)); sheet.addMergedRegion(new CellRangeAddress(55, 55, 7, 11)); sheet.addMergedRegion(new CellRangeAddress(55, 55, 13, 17)); sheet.addMergedRegion(new CellRangeAddress(55, 55, 19, 23)); sheet.addMergedRegion(new CellRangeAddress(55, 55, 25, 29)); sheet.addMergedRegion(new CellRangeAddress(69, 69, 1, 5)); sheet.addMergedRegion(new CellRangeAddress(69, 69, 7, 11)); sheet.addMergedRegion(new CellRangeAddress(69, 69, 13, 17)); sheet.addMergedRegion(new CellRangeAddress(69, 69, 19, 23)); sheet.addMergedRegion(new CellRangeAddress(69, 69, 25, 29)); //merge cells de programa educativo sheet.addMergedRegion(new CellRangeAddress(11, 11, 2, 3)); sheet.addMergedRegion(new CellRangeAddress(11, 11, 8, 9)); sheet.addMergedRegion(new CellRangeAddress(11, 11, 14, 15)); sheet.addMergedRegion(new CellRangeAddress(11, 11, 20, 21)); sheet.addMergedRegion(new CellRangeAddress(11, 11, 26, 27)); sheet.addMergedRegion(new CellRangeAddress(25, 25, 2, 3)); sheet.addMergedRegion(new CellRangeAddress(25, 25, 8, 9)); sheet.addMergedRegion(new CellRangeAddress(25, 25, 14, 15)); sheet.addMergedRegion(new CellRangeAddress(25, 25, 20, 21)); sheet.addMergedRegion(new CellRangeAddress(25, 25, 26, 27)); sheet.addMergedRegion(new CellRangeAddress(39, 39, 2, 3)); sheet.addMergedRegion(new CellRangeAddress(39, 39, 8, 9)); sheet.addMergedRegion(new CellRangeAddress(39, 39, 14, 15)); sheet.addMergedRegion(new CellRangeAddress(39, 39, 20, 21)); sheet.addMergedRegion(new CellRangeAddress(39, 39, 26, 27)); sheet.addMergedRegion(new CellRangeAddress(53, 53, 2, 3)); sheet.addMergedRegion(new CellRangeAddress(53, 53, 8, 9)); sheet.addMergedRegion(new CellRangeAddress(53, 53, 14, 15)); sheet.addMergedRegion(new CellRangeAddress(53, 53, 20, 21)); sheet.addMergedRegion(new CellRangeAddress(53, 53, 26, 27)); sheet.addMergedRegion(new CellRangeAddress(67, 67, 2, 3)); sheet.addMergedRegion(new CellRangeAddress(67, 67, 8, 9)); sheet.addMergedRegion(new CellRangeAddress(67, 67, 14, 15)); sheet.addMergedRegion(new CellRangeAddress(67, 67, 20, 21)); sheet.addMergedRegion(new CellRangeAddress(67, 67, 26, 27)); //} //aqui cambie jesus ruelas //mostraremos tabla con // Programas educativos // Total Racs entregados // Total Esperados //preparamos informacion para insertar List<Programaeducativo> programasByUnidad = getProgramasByUnidad(); List<Planestudio> planesByPrograma = getPlanesByPrograma(); ArrayList<String> listaProgEdContar = esperadosDelegate.getSemadoroProgEdValor(1); //setCellStyle(style); //setExDat(sheet, 7, 1, "Concentrado de Reporte de Avance de Contenido Temtico General por Programa Educativo"); //imrpiimiremos la tabla // Definimos los encabezados de la tabla int pos = 0; int row = 11; int col = 1; Boolean bandPe = false; for (Programaeducativo pe : programasByUnidad) { for (String peContar : listaProgEdContar) { String[] contarEntEspProgEd; if (listaProgEdContar.size() >= pos) { if (peContar.contains(pe.getPednombre())) { contarEntEspProgEd = listaProgEdContar.get(pos).split("-"); setExDat(sheet, row, col, "Clave"); setExDat(sheet, row, col + 1, "Programa Educativo"); setExDat(sheet, row, col + 3, "Plan de Estudios"); setExDat(sheet, row, col + 4, "Responsable"); // if (contarEntEspProgEd[0].equalsIgnoreCase(programasByUnidad.get(0).getPednombre())) { setExDat(sheet, row + 1, col, pe.getPedclave()); setExDat(sheet, row + 1, col + 1, pe.getPednombre()); if (!(planesByPrograma.isEmpty())) { setExDat(sheet, row + 1, col + 2, planesByPrograma.get(0).getPesvigenciaPlan()); } setExDat(sheet, row + 1, col + 3, ""); // } setExDat(sheet, row + 2, col, "Total de RACT General de " + programasByUnidad.get(0).getPednombre()); setExDat(sheet, row + 3, col, "Resumen de totales \r\n por numero de RACT"); setExDat(sheet, row + 3, col + 1, "Total entregados"); setExDat(sheet, row + 3, col + 2, "%"); setExDat(sheet, row + 3, col + 3, "Total esperados"); setExDat(sheet, row + 3, col + 4, "%"); sheet.getRow(row + 3).getCell(1);//aqui modifique jesus ruelas float porcentEnt = (Float.parseFloat(contarEntEspProgEd[1])) / (Float.parseFloat(contarEntEspProgEd[2])) * 100; float porcentEsp = 100 - porcentEnt; // setExDat(sheet, 15, 1, "Todos los RACTS"); // setExDat(sheet, 15, 2, contarEntEspProgEd[1]); // setExDat(sheet, 15, 3, "" + porcentEnt + "%"); // setExDat(sheet, 15, 4, contarEntEspProgEd[2]); // setExDat(sheet, 15, 5, "" + porcentEsp + "%"); //String[] contarEntEspProgEd; String[] contarEntRact1; String[] contarEntRact2; String[] contarEntRact3; int esperadosProgEdUnicoRact = 0; contarEntRact1 = contarEntEspProgEd[3].split(":"); contarEntRact2 = contarEntEspProgEd[4].split(":"); contarEntRact3 = contarEntEspProgEd[5].split(":"); esperadosProgEdUnicoRact = (Integer.parseInt(contarEntEspProgEd[2])) / 3; float contarPorcentEntRact1 = (Float.parseFloat(contarEntRact1[1])) / ((float) esperadosProgEdUnicoRact) * 100; float contarPorcentEntRact2 = (Float.parseFloat(contarEntRact2[1])) / ((float) esperadosProgEdUnicoRact) * 100; float contarPorcentEntRact3 = (Float.parseFloat(contarEntRact3[1])) / ((float) esperadosProgEdUnicoRact) * 100; float contarPorcentEspRact1 = 100 - contarPorcentEntRact1; float contarPorcentEspRact2 = 100 - contarPorcentEntRact2; float contarPorcentEspRact3 = 100 - contarPorcentEntRact3; setExDat(sheet, row + 4, col, "RACT 1"); setExDat(sheet, row + 4, col + 1, contarEntRact1[1]); setExDat(sheet, row + 4, col + 2, "" + contarPorcentEntRact1 + "%"); setExDat(sheet, row + 4, col + 3, esperadosProgEdUnicoRact); setExDat(sheet, row + 4, col + 4, "" + contarPorcentEspRact1 + "%"); setExDat(sheet, row + 5, col, "RACT 2"); setExDat(sheet, row + 5, col + 1, contarEntRact2[1]); setExDat(sheet, row + 5, col + 2, "" + contarPorcentEntRact2 + "%"); setExDat(sheet, row + 5, col + 3, esperadosProgEdUnicoRact); setExDat(sheet, row + 5, col + 4, "" + contarPorcentEspRact2 + "%"); setExDat(sheet, row + 6, col, "RACT 3"); setExDat(sheet, row + 6, col + 1, contarEntRact3[1]); setExDat(sheet, row + 6, col + 2, "" + contarPorcentEntRact3 + "%"); setExDat(sheet, row + 6, col + 3, esperadosProgEdUnicoRact); setExDat(sheet, row + 6, col + 4, "" + contarPorcentEspRact3 + "%"); setExDat(sheet, row + 7, col, "Todos los RACTS"); setExDat(sheet, row + 7, col + 1, contarEntEspProgEd[1]); setExDat(sheet, row + 7, col + 2, "" + porcentEnt + "%"); setExDat(sheet, row + 7, col + 3, contarEntEspProgEd[2]); setExDat(sheet, row + 7, col + 4, "" + porcentEsp + "%"); setStyleCell(sheet, headerTabla, row, col); setStyleCell(sheet, headerTabla, row, col + 1); setStyleCell(sheet, headerTabla, row, col + 2); setStyleCell(sheet, headerTabla, row, col + 3); setStyleCell(sheet, headerTabla, row, col + 4); setStyleCell(sheet, headerTabla, row + 2, col); setStyleCell(sheet, headerTabla, row + 2, col + 1); setStyleCell(sheet, headerTabla, row + 2, col + 2); setStyleCell(sheet, headerTabla, row + 2, col + 3); setStyleCell(sheet, headerTabla, row + 3, col); setStyleCell(sheet, headerTabla, row + 3, col + 1); setStyleCell(sheet, headerTabla, row + 3, col + 2); setStyleCell(sheet, headerTabla, row + 3, col + 3); setStyleCell(sheet, headerTabla, row + 3, col + 4); bandPe = true; pos++; } } if (bandPe == true) { if (col >= 25) { row = row + 14; col = -5; } col = col + 6; bandPe = false; } } } /*sheet.autoSizeColumn(2); sheet.autoSizeColumn(3); sheet.autoSizeColumn(4);*/ //imprimimos la informacion en su lugar int prow = 14; for (Programaeducativo programa : programasByUnidad) { if (selectProgramEducativo.contains(programa.getPedid().toString())) { setExDat(sheet, prow, 17, programa.getPednombre()); setExDat(sheet, prow, 18, 75); setExDat(sheet, prow, 19, 100); prow++; } } // } //} //finalizamos con //metodo para descargar el objeto System.out.println("Generando Excel"); if (criterio != "" && reporte != "") { FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); externalContext.setResponseContentType("application/vnd.ms-excel"); externalContext.setResponseHeader("Content-Disposition", "attachment; filename=\"" + nombreLibro + ".xls\""); workbook.write(externalContext.getResponseOutputStream()); facesContext.responseComplete(); } else { System.out.println("No se Genero por: Criterio->" + criterio + " , Reporte->" + reporte); } }