List of usage examples for org.apache.poi.ss.usermodel Cell setCellStyle
void setCellStyle(CellStyle style);
Set the style for the cell.
From source file:com.sec.ose.osi.report.standard.BillOfMaterialsSheetTemplate.java
License:Open Source License
protected void createTitle() { // Title//w w w . j a v a 2 s . c o m Row row = sheet.createRow(ROW_1); row.setHeight((short) (43 * BASE_HEIGHT)); sheet.addMergedRegion(CellRangeAddress.valueOf("A1:F1")); Cell cell = row.createCell(COL_A); cell.setCellValue(sheet.getSheetName()); cell.setCellStyle(titleStyle); }
From source file:com.sec.ose.osi.report.standard.BillOfMaterialsSheetTemplate.java
License:Open Source License
protected void createTable() { short mainItemThickness = (short) (24 * BASE_HEIGHT); short subItemThickness = (short) (18 * BASE_HEIGHT); CellStyle styleMainItem = getCellStyle(ROYAL_BLUE, getFont(FONT_WHITE, (short) 12, true)); // ROW_2//w ww.j av a2 s. com Row row = sheet.createRow(ROW_2); row.setHeight(mainItemThickness); sheet.addMergedRegion(CellRangeAddress.valueOf("A2:F2")); Cell cell = row.createCell(COL_A); cell.setCellValue("Open source License Verification Result "); cell.setCellStyle(styleMainItem); row.createCell(COL_B).setCellStyle(styleMainItem); row.createCell(COL_C).setCellStyle(styleMainItem); row.createCell(COL_D).setCellStyle(styleMainItem); row.createCell(COL_E).setCellStyle(styleMainItem); row.createCell(COL_F).setCellStyle(styleMainItem); // ROW_3 row = sheet.createRow(ROW_3); row.setHeight(subItemThickness); CellStyle style = getCellStyle(PALE_BLUE, getFont(FONT_BLACK, (short) 10, false)); cell = row.createCell(COL_A); cell.setCellValue("Category"); cell.setCellStyle(style); cell = row.createCell(COL_B); cell.setCellValue("Files"); cell.setCellStyle(style); cell = row.createCell(COL_C); cell.setCellValue("Files #"); cell.setCellStyle(style); cell = row.createCell(COL_D); cell.setCellValue("Component"); cell.setCellStyle(style); cell = row.createCell(COL_E); cell.setCellValue("License"); cell.setCellStyle(style); cell = row.createCell(COL_F); cell.setCellValue("Remark"); cell.setCellStyle(style); }
From source file:com.sec.ose.osi.report.standard.BillOfMaterialsSheetTemplate.java
License:Open Source License
public void writeBillOfMaterialsRow(ArrayList<BillOfMaterialsRow> billOfMaterialsList) { for (BillOfMaterialsRow billOfMaterialsRow : billOfMaterialsList) { Row row = sheet.createRow(curRow++); Cell cell = row.createCell(ISheetTemplate.COL_A); cell.setCellValue(billOfMaterialsRow.getCategory()); cell.setCellStyle(normalStyle); cell = row.createCell(ISheetTemplate.COL_B); cell.setCellValue(billOfMaterialsRow.getMatchedFiles()); cell.setCellStyle(leftStyle);//from w ww.ja va 2 s . co m cell = row.createCell(ISheetTemplate.COL_C); cell.setCellValue(billOfMaterialsRow.getMatchedFileCounts()); cell.setCellStyle(normalStyle); cell = row.createCell(ISheetTemplate.COL_D); cell.setCellValue(billOfMaterialsRow.getComponent()); cell.setCellStyle(normalStyle); cell = row.createCell(ISheetTemplate.COL_E); String license = billOfMaterialsRow.getLicense(); cell.setCellValue(license); CellStyle licenseCellStyle = getCellStyle(WHITE, getFont(FONT_BLACK, (short) 10, false)); for (String criticalLicense : criticalLicenseList) { if (license.contains(criticalLicense)) { licenseCellStyle.setFont(getFont(RED, (short) 10, false)); } } for (String majorLicense : majorLicenseList) { if (license.contains(majorLicense)) { licenseCellStyle.setFont(getFont(ORANGE, (short) 10, false)); } } cell.setCellStyle(licenseCellStyle); cell = row.createCell(ISheetTemplate.COL_F); cell.setCellValue(billOfMaterialsRow.getComment()); cell.setCellStyle(leftStyle); } }
From source file:com.sec.ose.osi.report.standard.BillOfMaterialsSheetTemplate.java
License:Open Source License
public void writeLicenseRow(ArrayList<LicenseSummaryRow> licenseList) { curRow += 3;//from ww w . j av a 2 s . c o m CellStyle styleLicenseTitle = getCellStyle(YELLOW, getFont(FONT_BLACK, (short) 10, true)); styleLicenseTitle.setAlignment(CellStyle.ALIGN_LEFT); CellStyle styleLicenseSum = getCellStyle(YELLOW, getFont(FONT_BLACK, (short) 10, true)); Row row = sheet.createRow(curRow++); Cell cell = row.createCell(ISheetTemplate.COL_B); cell.setCellValue("License State"); cell.setCellStyle(styleLicenseTitle); cell = row.createCell(ISheetTemplate.COL_C); cell.setCellFormula("SUM(C" + (curRow + 1) + ":C" + (curRow + licenseList.size()) + ")"); cell.setCellStyle(styleLicenseSum); for (LicenseSummaryRow licenseRow : licenseList) { row = sheet.createRow(curRow++); cell = row.createCell(ISheetTemplate.COL_B); cell.setCellValue(licenseRow.getLicense()); cell.setCellStyle(leftStyle); cell = row.createCell(ISheetTemplate.COL_C); cell.setCellValue(licenseRow.getCount()); cell.setCellStyle(normalStyle); } }
From source file:com.sec.ose.osi.report.standard.CoverSheetTemplate.java
License:Open Source License
protected void createTable() { Font fontBold = getFont(FONT_BLACK, (short) 11, true); Font fontNormal = getFont(FONT_BLACK, (short) 11, false); short tableThickness = (short) (37 * BASE_HEIGHT); short toolThickness = (short) (55 * BASE_HEIGHT); // ROW_10/*from w w w . ja v a 2 s .c o m*/ Row row = sheet.createRow(ROW_10); row.setHeight(tableThickness); XSSFCellStyle style = getCellStyle(BORDER_LEFT | BORDER_TOP, fontBold); Cell cell = row.createCell(COL_C); cell.setCellValue("Project Name"); cell.setCellStyle(style); style = getCellStyle(BORDER_TOP, fontNormal); row.createCell(COL_D).setCellStyle(style); style = getCellStyle(BORDER_TOP, fontBold); cell = row.createCell(COL_E); cell.setCellValue("Date"); cell.setCellStyle(style); style = getCellStyle(BORDER_RIGHT | BORDER_TOP, fontNormal); row.createCell(COL_F).setCellStyle(style); // ROW_11 row = sheet.createRow(ROW_11); row.setHeight(tableThickness); sheet.addMergedRegion(CellRangeAddress.valueOf("D11:F11")); style = getCellStyle(BORDER_LEFT, fontBold); cell = row.createCell(COL_C); cell.setCellValue("Author"); cell.setCellStyle(style); style = getCellStyle(0, fontNormal); row.createCell(COL_D).setCellStyle(style); row.createCell(COL_E).setCellStyle(style); style = getCellStyle(BORDER_RIGHT, fontNormal); row.createCell(COL_F).setCellStyle(style); // ROW_12 row = sheet.createRow(ROW_12); row.setHeight(tableThickness); sheet.addMergedRegion(CellRangeAddress.valueOf("D12:F12")); style = getCellStyle(BORDER_LEFT, fontBold); cell = row.createCell(COL_C); cell.setCellValue("Team"); cell.setCellStyle(style); style = getCellStyle(0, fontNormal); row.createCell(COL_D).setCellStyle(style); row.createCell(COL_E).setCellStyle(style); style = getCellStyle(BORDER_RIGHT, fontNormal); row.createCell(COL_F).setCellStyle(style); // ROW_13 row = sheet.createRow(ROW_13); row.setHeight(toolThickness); sheet.addMergedRegion(CellRangeAddress.valueOf("D13:F13")); style = getCellStyle(BORDER_BOTTOM | BORDER_LEFT, fontBold); cell = row.createCell(COL_C); cell.setCellValue("Tool"); cell.setCellStyle(style); style = getCellStyle(BORDER_BOTTOM, fontNormal); row.createCell(COL_D).setCellStyle(style); row.createCell(COL_E).setCellStyle(style); style = getCellStyle(BORDER_BOTTOM | BORDER_RIGHT, fontNormal); row.createCell(COL_F).setCellStyle(style); }
From source file:com.sec.ose.osi.report.standard.IdentifiedFilesSheetTemplate.java
License:Open Source License
protected void createTitle() { // Title// w w w .j a v a 2s .c o m Row row = sheet.createRow(ROW_1); row.setHeight((short) (43 * BASE_HEIGHT)); sheet.addMergedRegion(CellRangeAddress.valueOf("A1:G1")); Cell cell = row.createCell(COL_A); cell.setCellValue("Identified Files"); cell.setCellStyle(titleStyle); }
From source file:com.sec.ose.osi.report.standard.IdentifiedFilesSheetTemplate.java
License:Open Source License
protected void createTable() { short subItemThickness = (short) (35 * BASE_HEIGHT); CellStyle styleSubItem = getCellStyle(ROYAL_BLUE, getFont(FONT_WHITE, (short) 10, true)); // ROW_2//from w w w.j a v a 2 s . c om Row row = sheet.createRow(ROW_2); row.setHeight(subItemThickness); Cell cell = row.createCell(COL_A); cell.setCellValue("ProjectName"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_B); cell.setCellValue("FullPath"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_C); cell.setCellValue("Component"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_D); cell.setCellValue("License"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_E); cell.setCellValue("DiscoveryType"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_F); cell.setCellValue("CodeMatch URL"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_G); cell.setCellValue("Comment"); cell.setCellStyle(styleSubItem); }
From source file:com.sec.ose.osi.report.standard.IdentifiedFilesSheetTemplate.java
License:Open Source License
public void writeRow(ArrayList<IdentifiedFilesRow> identifiedFilesRowList) { for (IdentifiedFilesRow identifiedFilesRow : identifiedFilesRowList) { Row row = sheet.createRow(curRow++); Cell cell = row.createCell(ISheetTemplate.COL_A); cell.setCellValue(identifiedFilesRow.getProjectName()); cell.setCellStyle(normalStyle); cell = row.createCell(ISheetTemplate.COL_B); cell.setCellValue(identifiedFilesRow.getFullPath()); cell.setCellStyle(leftStyle);//from w w w. j av a 2 s . c o m cell = row.createCell(ISheetTemplate.COL_C); cell.setCellValue(identifiedFilesRow.getComponent()); cell.setCellStyle(normalStyle); cell = row.createCell(ISheetTemplate.COL_D); cell.setCellValue(identifiedFilesRow.getLicense()); cell.setCellStyle(normalStyle); cell = row.createCell(ISheetTemplate.COL_E); cell.setCellValue(identifiedFilesRow.getDiscoveryType()); cell.setCellStyle(normalStyle); cell = row.createCell(ISheetTemplate.COL_F); cell.setCellStyle(normalStyle); String value = ""; String url = identifiedFilesRow.getUrl(); if (url != null && (url.length() != 0) && !"null".equals(url)) { Hyperlink link = wb.getCreationHelper().createHyperlink(Hyperlink.LINK_URL); link.setAddress(url); link.setLabel(url); cell.setHyperlink(link); cell.setCellStyle(getCellStyle(WHITE, getFont(BLUE, (short) 10, false))); value = "Show Matched Code (" + (identifiedFilesRow.getCodeMatchCnt()) + ")"; } cell.setCellValue(value); cell = row.createCell(ISheetTemplate.COL_G); cell.setCellValue(identifiedFilesRow.getComment()); cell.setCellStyle(leftStyle); } }
From source file:com.sec.ose.osi.report.standard.SummarySheetTemplate.java
License:Open Source License
protected void createTitle() { // Title//from w ww .j a va 2 s. c om Row row = sheet.createRow(ROW_1); row.setHeight((short) (43 * BASE_HEIGHT)); sheet.addMergedRegion(CellRangeAddress.valueOf("A1:K1")); Cell cell = row.createCell(COL_A); cell.setCellValue("Summary"); cell.setCellStyle(titleStyle); }
From source file:com.sec.ose.osi.report.standard.SummarySheetTemplate.java
License:Open Source License
protected void createTable() { short mainItemBorderThickness = (short) (24 * BASE_HEIGHT); short subItemBorderThickness = (short) (45 * BASE_HEIGHT); CellStyle styleMainItem = getCellStyle(ROYAL_BLUE, getFont(FONT_WHITE, (short) 12, true)); CellStyle styleSubItem = getCellStyle(ROYAL_BLUE, getFont(FONT_WHITE, (short) 10, false)); // ROW_2//from w w w . j av a2 s . c o m Row row = sheet.createRow(ROW_2); row.setHeight(mainItemBorderThickness); sheet.addMergedRegion(CellRangeAddress.valueOf("A2:A3")); sheet.addMergedRegion(CellRangeAddress.valueOf("B2:B3")); sheet.addMergedRegion(CellRangeAddress.valueOf("C2:I2")); sheet.addMergedRegion(CellRangeAddress.valueOf("J2:K2")); Cell cell = row.createCell(COL_A); cell.setCellValue("Classification"); cell.setCellStyle(styleMainItem); cell = row.createCell(COL_B); cell.setCellValue("Project Name"); cell.setCellStyle(styleMainItem); cell = row.createCell(COL_C); cell.setCellValue("Source Code Scan Result"); cell.setCellStyle(styleMainItem); row.createCell(COL_D).setCellStyle(styleMainItem); row.createCell(COL_E).setCellStyle(styleMainItem); row.createCell(COL_F).setCellStyle(styleMainItem); row.createCell(COL_G).setCellStyle(styleMainItem); row.createCell(COL_H).setCellStyle(styleMainItem); row.createCell(COL_I).setCellStyle(styleMainItem); // Identify Result CellStyle style = getCellStyle(LIGHT_RED, getFont(DARK_RED, (short) 12, true)); cell = row.createCell(COL_J); cell.setCellValue("Identify Result"); cell.setCellStyle(style); row.createCell(COL_K).setCellStyle(style); // ROW_3 row = sheet.createRow(ROW_3); row.setHeight(subItemBorderThickness); cell = row.createCell(COL_A); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_B); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_C); cell.setCellValue("Scan Date"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_D); cell.setCellValue("Scan time\n(HH:MM:SS)"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_E); cell.setCellValue("Pending Files"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_F); cell.setCellValue("Pending\n(%)"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_G); cell.setCellValue("Total Files"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_H); cell.setCellValue("Exceptional Files"); cell.setCellStyle(styleSubItem); cell = row.createCell(COL_I); cell.setCellValue("Bytes"); cell.setCellStyle(styleSubItem); // Identify Result style = getCellStyle(LIGHT_RED, getFont(DARK_RED, (short) 10, true)); cell = row.createCell(COL_J); cell.setCellValue("Total Identified Files"); cell.setCellStyle(style); cell = row.createCell(COL_K); cell.setCellValue("Current Pending Files"); cell.setCellStyle(style); }