List of usage examples for org.apache.poi.xssf.usermodel XSSFRow createCell
@Override public XSSFCell createCell(int columnIndex)
From source file:org.jboss.windup.reporting.spreadsheet.ScorecardReporter.java
License:Open Source License
private static void appendMentoringTitleRow(XSSFWorkbook wb, XSSFSheet sheet, int rowNum) { XSSFCellStyle titleCell = wb.createCellStyle(); Color titleCellGrey = new Color(0xECECEC); XSSFColor color = new XSSFColor(titleCellGrey); titleCell.setFillForegroundColor(color); titleCell.setBorderBottom(CellStyle.BORDER_MEDIUM); titleCell.setBorderTop(CellStyle.BORDER_MEDIUM); titleCell.setFillPattern(CellStyle.SOLID_FOREGROUND); Font titleFormat = wb.createFont(); titleFormat.setBoldweight(Font.BOLDWEIGHT_BOLD); titleFormat.setColor((short) 0x0); titleCell.setFont(titleFormat);// ww w . j a va 2 s . c o m XSSFRow row = sheet.createRow(rowNum); XSSFCell t1 = row.createCell(0); t1.setCellValue("Migration Service Estimate"); t1.setCellStyle(titleCell); XSSFCell t2 = row.createCell(1); t2.setCellStyle(titleCell); XSSFCell t3 = row.createCell(2); t3.setCellStyle(titleCell); XSSFCell t4 = row.createCell(3); t4.setCellStyle(titleCell); }
From source file:org.jboss.windup.reporting.spreadsheet.ScorecardReporter.java
License:Open Source License
private static void appendMentoringTotalRow(XSSFWorkbook wb, XSSFSheet sheet, int rowNum, int start, int end) { Font boldFont = wb.createFont(); boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD); boldFont.setColor((short) 0x0); XSSFCellStyle commentCell = wb.createCellStyle(); commentCell.setBorderTop(CellStyle.BORDER_THIN); XSSFCellStyle totalCell = wb.createCellStyle(); totalCell.setBorderTop(CellStyle.BORDER_THIN); totalCell.setFont(boldFont);/*from w w w. j a va2s . c o m*/ XSSFCellStyle totalCellRight = wb.createCellStyle(); totalCellRight.setBorderTop(CellStyle.BORDER_THIN); totalCellRight.setAlignment(HorizontalAlignment.RIGHT); totalCellRight.setFont(boldFont); XSSFRow row = sheet.createRow(rowNum); XSSFCell t1 = row.createCell(0); t1.setCellValue("Total:"); t1.setCellStyle(totalCellRight); XSSFCell t2 = row.createCell(1); t2.setCellFormula("SUM(B" + start + ":B" + end + ")"); t2.setCellStyle(totalCell); XSSFCell t3 = row.createCell(2); t3.setCellStyle(totalCell); XSSFCell t4 = row.createCell(3); t4.setCellStyle(commentCell); }
From source file:org.jboss.windup.reporting.spreadsheet.ScorecardReporter.java
License:Open Source License
private static void appendNotesRow(XSSFWorkbook wb, XSSFSheet sheet, int rowNum, String app, double effort, String notes) {//from w ww. j av a2 s .c o m XSSFRow row = sheet.createRow(rowNum); XSSFCell t1 = row.createCell(0); t1.setCellValue(app); XSSFCell t2 = row.createCell(1); XSSFCellStyle t2s = wb.createCellStyle(); t2s.setAlignment(HorizontalAlignment.RIGHT); t2.setCellStyle(t2s); t2.setCellValue(effort); row.createCell(2); XSSFCell t4 = row.createCell(3); t4.setCellValue(notes); }
From source file:org.jmesa.view.excel.Excel2007View.java
License:Apache License
@Override public Object render() { XSSFWorkbook workbook = new XSSFWorkbook(); Table table = this.getTable(); String caption = table.getCaption(); if (!StringUtils.hasText(caption)) { caption = "JMesa Export"; }/* w w w .ja va 2 s.c o m*/ XSSFSheet sheet = workbook.createSheet(caption); Row row = table.getRow(); row.getRowRenderer(); List<Column> columns = table.getRow().getColumns(); // renderer header XSSFRow hssfRow = sheet.createRow(0); int columncount = 0; for (Column col : columns) { XSSFCell cell = hssfRow.createCell(columncount++); cell.setCellValue(new XSSFRichTextString(col.getTitle())); } // renderer body Collection<?> items = getCoreContext().getPageItems(); int rowcount = 1; for (Object item : items) { XSSFRow r = sheet.createRow(rowcount++); columncount = 0; for (Column col : columns) { XSSFCell cell = r.createCell(columncount++); Object value = col.getCellRenderer().render(item, rowcount); if (value == null) { value = ""; } if (value instanceof Number) { Double number = Double.valueOf(value.toString()); cell.setCellValue(number); } else { cell.setCellValue(new XSSFRichTextString(value.toString())); } } } return workbook; }
From source file:org.kopsox.spreadsheet.data.ooxml.OOXMLSheet.java
License:Open Source License
@Override public void setFormualaAt(int row, int column, String formula) { XSSFRow excelRow = sheet.getRow(row); if (excelRow == null) { excelRow = sheet.createRow(row); }/*from w w w .ja v a 2 s .c o m*/ XSSFCell excelCell = excelRow.getCell(column); if (excelCell == null) { excelCell = excelRow.createCell(column); } excelCell.setCellFormula(formula); excelCell.setCellType(Cell.CELL_TYPE_FORMULA); }
From source file:org.kopsox.spreadsheet.data.ooxml.OOXMLSheet.java
License:Open Source License
@Override public void setValueAt(int row, int column, String value) { XSSFRow excelRow = sheet.getRow(row); if (excelRow == null) { excelRow = sheet.createRow(row); }//from ww w . ja va 2s . c o m XSSFCell excelCell = excelRow.getCell(column); if (excelCell == null) { excelCell = excelRow.createCell(column); } XSSFRichTextString str = new XSSFRichTextString(value); excelCell.setCellValue(str); excelCell.setCellType(Cell.CELL_TYPE_STRING); }
From source file:org.kopsox.spreadsheet.data.ooxml.OOXMLSheet.java
License:Open Source License
@Override public void setValueAt(int row, int column, double value) { XSSFRow excelRow = sheet.getRow(row); if (excelRow == null) { excelRow = sheet.createRow(row); }// w w w .j a va 2s. c om XSSFCell excelCell = excelRow.getCell(column); if (excelCell == null) { excelCell = excelRow.createCell(column); } excelCell.setCellValue(value); excelCell.setCellType(Cell.CELL_TYPE_NUMERIC); }
From source file:org.kopsox.spreadsheet.data.ooxml.OOXMLSheet.java
License:Open Source License
@Override public void setValueAt(int row, int column, Date value, String format) { XSSFRow excelRow = sheet.getRow(row); if (excelRow == null) { excelRow = sheet.createRow(row); }/* w w w.j av a 2s . com*/ XSSFCell excelCell = excelRow.getCell(column); if (excelCell == null) { excelCell = excelRow.createCell(column); } CreationHelper createHelper = this.sheet.getWorkbook().getCreationHelper(); CellStyle cellStyle = this.sheet.getWorkbook().createCellStyle(); cellStyle.setDataFormat(createHelper.createDataFormat().getFormat(format)); excelCell.setCellStyle(cellStyle); excelCell.setCellValue(value); excelCell.setCellType(Cell.CELL_TYPE_NUMERIC); }
From source file:org.kopsox.spreadsheet.data.ooxml.OOXMLSheet.java
License:Open Source License
@Override public void setValueAt(int row, int column, boolean value) { XSSFRow excelRow = sheet.getRow(row); if (excelRow == null) { excelRow = sheet.createRow(row); }/*from w w w . jav a2 s .c o m*/ XSSFCell excelCell = excelRow.getCell(column); if (excelCell == null) { excelCell = excelRow.createCell(column); } excelCell.setCellValue(value); excelCell.setCellType(Cell.CELL_TYPE_BOOLEAN); }
From source file:org.kopsox.spreadsheet.data.ooxml.OOXMLSheet.java
License:Open Source License
@Override public void setValueAt(int row, int column, Time value, String format) { XSSFRow excelRow = sheet.getRow(row); if (excelRow == null) { excelRow = sheet.createRow(row); }// w ww . j ava 2 s .co m XSSFCell excelCell = excelRow.getCell(column); if (excelCell == null) { excelCell = excelRow.createCell(column); } CreationHelper createHelper = this.sheet.getWorkbook().getCreationHelper(); CellStyle cellStyle = this.sheet.getWorkbook().createCellStyle(); cellStyle.setDataFormat(createHelper.createDataFormat().getFormat(format)); excelCell.setCellStyle(cellStyle); excelCell.setCellValue(value); excelCell.setCellType(Cell.CELL_TYPE_NUMERIC); }