List of usage examples for org.apache.poi.ss.usermodel Font setUnderline
void setUnderline(byte underline);
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
private void addTotalsPerLang(Workbook p_workbook, Sheet p_sheet, final int p_sheetCategory, IntHolder p_row) throws Exception { Font subTotalFont = p_workbook.createFont(); subTotalFont.setBoldweight(Font.BOLDWEIGHT_BOLD); subTotalFont.setColor(IndexedColors.BLACK.getIndex()); subTotalFont.setUnderline(Font.U_NONE); subTotalFont.setFontName("Arial"); subTotalFont.setFontHeightInPoints((short) 10); CellStyle subTotalStyle = p_workbook.createCellStyle(); subTotalStyle.setFont(subTotalFont); String title = m_bundle.getString("lb_total_cost_per_lang"); int row = p_row.getValue() + 4; // skip a row ArrayList<String> locales = new ArrayList<String>(totalCost.keySet()); SortUtil.sort(locales);// w ww . j a v a 2s .com int col = m_data.getSumStartCol(); Row theRow = getRow(p_sheet, row); Cell cell_Title = getCell(theRow, col - 3); cell_Title.setCellValue(title); cell_Title.setCellStyle(subTotalStyle); File imgFile = File.createTempFile("GSJobChart", ".png"); JfreeCharUtil.drawPieChart2D("", totalCostDate, imgFile); Drawing patriarch = p_sheet.createDrawingPatriarch(); XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 15, row - 1, 22, row + 24); ByteArrayOutputStream img_bytes = new ByteArrayOutputStream(); InputStream is = imgFile.toURI().toURL().openStream(); int b; while ((b = is.read()) != -1) { img_bytes.write(b); } is.close(); int i = p_workbook.addPicture(img_bytes.toByteArray(), SXSSFWorkbook.PICTURE_TYPE_PNG); patriarch.createPicture(anchor, i); for (String locale : locales) { List<Integer> indexs = totalCost.get(locale); StringBuffer values = new StringBuffer(); for (Integer index : indexs) { if (values.length() == 0) { values.append("SUM("); } else { values.append("+"); } values.append(totalCol).append(index); } values.append(")"); Row perRow = getRow(p_sheet, row); Cell cell_Locale = getCell(perRow, col - 1); cell_Locale.setCellValue(locale); cell_Locale.setCellStyle(getContentStyle(p_workbook)); Cell cell_Total = getCell(perRow, col); cell_Total.setCellFormula(values.toString()); cell_Total.setCellStyle(getMoneyStyle(p_workbook)); row++; } // Reset total column number for every sheet. totalCol = null; }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
private CellStyle getHeaderStyle(Workbook p_workbook) { if (headerStyle == null) { Font headerFont = p_workbook.createFont(); headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD); headerFont.setColor(IndexedColors.BLACK.getIndex()); headerFont.setUnderline(Font.U_NONE); headerFont.setFontName("Arial"); headerFont.setFontHeightInPoints((short) 9); CellStyle cs = p_workbook.createCellStyle(); cs.setFont(headerFont);//from ww w .jav a 2 s. c om cs.setWrapText(true); cs.setFillPattern(CellStyle.SOLID_FOREGROUND); cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); cs.setBorderTop(CellStyle.BORDER_THIN); cs.setBorderRight(CellStyle.BORDER_THIN); cs.setBorderBottom(CellStyle.BORDER_THIN); cs.setBorderLeft(CellStyle.BORDER_THIN); headerStyle = cs; } return headerStyle; }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
private CellStyle getRedCellStyle(Workbook p_workbook) throws Exception { if (redCellStyle == null) { Font redFont = p_workbook.createFont(); redFont.setFontName("Arial"); redFont.setUnderline(Font.U_NONE); redFont.setFontHeightInPoints((short) 10); CellStyle cs = p_workbook.createCellStyle(); cs.setFont(redFont);//from w w w . jav a 2s . c o m cs.setWrapText(true); cs.setFillPattern(CellStyle.SOLID_FOREGROUND); cs.setFillForegroundColor(IndexedColors.RED.getIndex()); redCellStyle = cs; } return redCellStyle; }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
private CellStyle getWrongJobStyle(Workbook p_workbook) throws Exception { if (wrongJobStyle == null) { Font wrongJobFont = p_workbook.createFont(); wrongJobFont.setBoldweight(Font.BOLDWEIGHT_BOLD); wrongJobFont.setColor(IndexedColors.GREY_50_PERCENT.getIndex()); wrongJobFont.setUnderline(Font.U_NONE); wrongJobFont.setFontName("Times"); wrongJobFont.setFontHeightInPoints((short) 11); CellStyle cs = p_workbook.createCellStyle(); cs.setFont(wrongJobFont);/*from w ww. j a v a 2s .c o m*/ wrongJobStyle = cs; } return wrongJobStyle; }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportForIPTranslatorGenerator.java
License:Apache License
private CellStyle getSubTotalStyle(Workbook p_workbook) throws Exception { if (subTotalStyle == null) { Font subTotalFont = p_workbook.createFont(); subTotalFont.setBoldweight(Font.BOLDWEIGHT_BOLD); subTotalFont.setColor(IndexedColors.BLACK.getIndex()); subTotalFont.setUnderline(Font.U_NONE); subTotalFont.setFontName("Arial"); subTotalFont.setFontHeightInPoints((short) 10); CellStyle cs = p_workbook.createCellStyle(); cs.setFont(subTotalFont);/*from w w w .ja va2s . c o m*/ cs.setWrapText(true); cs.setBorderTop(CellStyle.BORDER_THIN); cs.setBorderBottom(CellStyle.BORDER_THIN); cs.setFillPattern(CellStyle.SOLID_FOREGROUND); cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); subTotalStyle = cs; } return subTotalStyle; }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.OnlineJobsReportGenerator.java
License:Apache License
private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception { String EMEA = CompanyWrapper.getCurrentCompanyName(); Font titleFont = p_workbook.createFont(); titleFont.setUnderline(Font.U_NONE); titleFont.setFontName("Arial"); titleFont.setFontHeightInPoints((short) 14); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); CellStyle titleStyle = p_workbook.createCellStyle(); titleStyle.setWrapText(false);/* www . j a v a 2 s . c o m*/ titleStyle.setFont(titleFont); Row firRow = getRow(p_sheet, 0); Cell titleCell = getCell(firRow, 0); titleCell.setCellValue(EMEA + " " + m_bundle.getString("lb_online")); titleCell.setCellStyle(titleStyle); p_sheet.setColumnWidth(0, 20 * 256); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.PostReviewQAReportGenerator.java
License:Apache License
/** * Add title to the sheet/* w ww . j av a2 s . com*/ * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception { Font titleFont = p_workBook.createFont(); titleFont.setUnderline(Font.U_NONE); titleFont.setFontName("Times"); titleFont.setFontHeightInPoints((short) 14); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); CellStyle cs = p_workBook.createCellStyle(); cs.setFont(titleFont); Row titleRow = getRow(p_sheet, 0); Cell titleCell = getCell(titleRow, 0); titleCell.setCellValue(m_bundle.getString("lb_post_review_qa_report")); titleCell.setCellStyle(cs); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.ReviewersCommentsReportGenerator.java
License:Apache License
/** * Add title to the sheet/*from ww w. j a v a2 s. c o m*/ * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception { Font titleFont = p_workBook.createFont(); titleFont.setUnderline(Font.U_NONE); titleFont.setFontName("Times"); titleFont.setFontHeightInPoints((short) 14); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); CellStyle cs = p_workBook.createCellStyle(); cs.setFont(titleFont); Row titleRow = getRow(p_sheet, 0); Cell titleCell = getCell(titleRow, 0); titleCell.setCellValue(m_bundle.getString("review_reviewers_comments")); titleCell.setCellStyle(cs); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.ReviewersCommentsSimpleReportGenerator.java
License:Apache License
/** * Add title to the sheet//from w ww .jav a 2 s .c om * * @param p_workBook * @param p_sheet * the sheet * @throws Exception */ private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception { Font titleFont = p_workBook.createFont(); titleFont.setUnderline(Font.U_NONE); titleFont.setFontName("Times"); titleFont.setFontHeightInPoints((short) 14); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); CellStyle cs = p_workBook.createCellStyle(); cs.setFont(titleFont); Row titleRow = getRow(p_sheet, 0); Cell titleCell = getCell(titleRow, 0); titleCell.setCellValue(m_bundle.getString("review_reviewers_comments_simple")); titleCell.setCellStyle(cs); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.generator.ReviewersCommentsSimpleReportGenerator.java
License:Apache License
private CellStyle getHeaderStyle(Workbook p_workbook) throws Exception { if (headerStyle == null) { Font font = p_workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_BOLD); font.setColor(IndexedColors.BLACK.getIndex()); font.setUnderline(Font.U_NONE); font.setFontName("Times"); font.setFontHeightInPoints((short) 11); CellStyle cs = p_workbook.createCellStyle(); cs.setFont(font);/*from w w w . j ava 2 s. c om*/ cs.setWrapText(true); cs.setFillPattern(CellStyle.SOLID_FOREGROUND); cs.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex()); cs.setBorderTop(CellStyle.BORDER_THIN); cs.setBorderRight(CellStyle.BORDER_THIN); cs.setBorderBottom(CellStyle.BORDER_THIN); cs.setBorderLeft(CellStyle.BORDER_THIN); headerStyle = cs; } return headerStyle; }