List of usage examples for org.apache.poi.ss.usermodel Sheet createRow
Row createRow(int rownum);
From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge.java
License:Open Source License
private void _generateDataCell(Object value, int rowCount, int cellCount, Sheet sheet) { Row row = sheet.getRow(rowCount);// w ww . ja va2 s . c om if (row == null) { row = sheet.createRow(rowCount); } Cell cell = row.createCell(cellCount); if (value != null) { cell.setCellValue(value.toString()); } }
From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge_sxssf.java
License:Open Source License
private void _generateID(Sheet sheet) { // Generate name. {/*from w w w . j a va 2s . c om*/ // Style, cell color. CellStyle attributeStyle = workBook.createCellStyle(); attributeStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); attributeStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font Font attributeFont = workBook.createFont(); attributeFont.setFontName("Verdana"); attributeFont.setColor(IndexedColors.BLUE.getIndex()); attributeStyle.setFont(attributeFont); // Style, border. attributeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(0); if (row == null) { row = sheet.createRow(0); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue("ID"); cell.setCellStyle(attributeStyle); } // Generate type { CellStyle typeStyle = workBook.createCellStyle(); typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(1); if (row == null) { row = sheet.createRow(1); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellStyle(typeStyle); } }
From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge_sxssf.java
License:Open Source License
private void _generateCell(EAttribute eAttribute, Sheet sheet) { // Generate name. {//w w w .j a v a 2s .com // Style, cell color. CellStyle attributeStyle = workBook.createCellStyle(); attributeStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); attributeStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font Font attributeFont = workBook.createFont(); attributeFont.setFontName("Verdana"); attributeFont.setColor(IndexedColors.BLUE.getIndex()); attributeStyle.setFont(attributeFont); // Style, border. attributeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(0); if (row == null) { row = sheet.createRow(0); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue(StringUtils.capitalize(eAttribute.getName())); cell.setCellStyle(attributeStyle); } // Generate type { CellStyle typeStyle = workBook.createCellStyle(); typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(1); if (row == null) { row = sheet.createRow(1); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue(eAttribute.getEType().getName()); cell.setCellStyle(typeStyle); } }
From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge_sxssf.java
License:Open Source License
private void _generateCell(EReference eReference, Sheet sheet) { // Generate name. {/*from w w w. java 2 s. c o m*/ // Style, cell color. CellStyle referenceStyle = workBook.createCellStyle(); referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font Font referenceFont = workBook.createFont(); referenceFont.setFontName("Verdana"); referenceFont.setColor(IndexedColors.DARK_RED.getIndex()); referenceStyle.setFont(referenceFont); // Style, border. referenceStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(0); if (row == null) { row = sheet.createRow(0); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue(StringUtils.capitalize(eReference.getName())); cell.setCellStyle(referenceStyle); } // Generate type { CellStyle typeStyle = workBook.createCellStyle(); typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(1); if (row == null) { row = sheet.createRow(1); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue(eReference.getEType().getName()); cell.setCellStyle(typeStyle); } }
From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge_sxssf.java
License:Open Source License
private void _generateMultiReferenceSource(EClass eClass, Sheet sheet) { // Generate name. {/*from w ww . j av a 2s .co m*/ // Style, cell color. CellStyle referenceStyle = workBook.createCellStyle(); referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font Font referenceFont = workBook.createFont(); referenceFont.setFontName("Verdana"); referenceFont.setColor(IndexedColors.DARK_RED.getIndex()); referenceStyle.setFont(referenceFont); // Style, border. referenceStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(0); if (row == null) { row = sheet.createRow(0); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue(StringUtils.capitalize(eClass.getName())); cell.setCellStyle(referenceStyle); } // Generate type { CellStyle typeStyle = workBook.createCellStyle(); typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(1); if (row == null) { row = sheet.createRow(1); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellStyle(typeStyle); } }
From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge_sxssf.java
License:Open Source License
private void _generateMultiRefCell(EReference eReference, Sheet sheet) { // Generate name. {/*from ww w .jav a2 s . c o m*/ // Style, cell color. CellStyle referenceStyle = workBook.createCellStyle(); referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font Font referenceFont = workBook.createFont(); referenceFont.setFontName("Verdana"); referenceFont.setColor(IndexedColors.DARK_RED.getIndex()); referenceStyle.setFont(referenceFont); // Style, border. referenceStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(0); if (row == null) { row = sheet.createRow(0); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue(StringUtils.capitalize(eReference.getName())); cell.setCellStyle(referenceStyle); } // Generate type { CellStyle typeStyle = workBook.createCellStyle(); typeStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); Row row = sheet.getRow(1); if (row == null) { row = sheet.createRow(1); } short lastCellNum = row.getLastCellNum(); if (lastCellNum == -1) { lastCellNum = 0; } Cell cell = row.createCell(lastCellNum); cell.setCellValue(eReference.getEType().getName()); cell.setCellStyle(typeStyle); } }
From source file:com.netxforge.netxstudio.server.logic.reporting.BaseNodeReportingLogic.java
License:Open Source License
public void createHeaderStructure(Sheet sheet) { CellStyle baseStyle = this.getWorkBook().createCellStyle(); baseStyle.setBorderTop(CellStyle.BORDER_MEDIUM); baseStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); baseStyle.setBorderLeft(CellStyle.BORDER_MEDIUM); baseStyle.setBorderRight(CellStyle.BORDER_MEDIUM); baseStyle.setAlignment(CellStyle.ALIGN_LEFT); CellStyle typeStyle = this.getWorkBook().createCellStyle(); typeStyle.cloneStyleFrom(baseStyle); Font typeFont = getWorkBook().createFont(); typeFont.setFontHeightInPoints((short) 24); typeStyle.setFont(typeFont);//ww w. j a va 2 s .com Row typeRow = sheet.createRow(0); typeCell = typeRow.createCell(0); typeCell.setCellValue("<Service Type>"); typeCell.setCellStyle(typeStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { typeRow.createCell(i).setCellStyle(typeStyle); } CellStyle titleStyle = this.getWorkBook().createCellStyle(); titleStyle.cloneStyleFrom(baseStyle); Font titleFont = getWorkBook().createFont(); titleFont.setFontHeightInPoints((short) 16); titleStyle.setFont(titleFont); Row titleRow = sheet.createRow(1); titleCell = titleRow.createCell(0); titleCell.setCellValue("<Report title>"); titleCell.setCellStyle(titleStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { titleRow.createCell(i).setCellStyle(titleStyle); } Row periodRow = sheet.createRow(2); periodCell = periodRow.createCell(0); periodCell.setCellValue("<Period>"); periodCell.setCellStyle(titleStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { periodRow.createCell(i).setCellStyle(typeStyle); } // Merge sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, HEADER_CELL_SIZE - 1)); sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, HEADER_CELL_SIZE - 1)); sheet.addMergedRegion(new CellRangeAddress(2, 2, 0, HEADER_CELL_SIZE - 1)); }
From source file:com.netxforge.netxstudio.server.logic.reporting.NodeResourceReportingLogic.java
License:Open Source License
@Override public void writeFinal(Sheet sheet) { Row row = sheet.getRow(INFO_ROW);/*w w w.j a v a 2 s. co m*/ if (row == null) { row = sheet.createRow(INFO_ROW); } Cell componentsSkippedInfoCell = row.createCell(INFO_COLUMN); componentsSkippedInfoCell .setCellValue("Number of not-reported Components (RAG Appropriate):" + this.componentsNotReported); }
From source file:com.netxforge.netxstudio.server.logic.reporting.ResourceReportingEngine.java
License:Open Source License
public void writeComponentLine(int newRow, Sheet sheet, Component component) { Row componentRow = sheet.createRow(newRow); Cell componentCell = componentRow.createCell(NODE_COLUMN + 1); // Build the presentation of a component. StringBuilder builder = new StringBuilder(); if (component instanceof Function) { builder.append(component.getName()); // DEBUG CODE. // if(component.getName().equals("amm02in0assoc0")){ // System.out.println("DEBUG this comp" + component.getName()); // }// w ww. j ava2 s.c o m } else if (component instanceof Equipment) { builder.append(((Equipment) component).getEquipmentCode()); builder.append( component.eIsSet(LibraryPackage.Literals.COMPONENT__NAME) ? " name:" + component.getName() : ""); } builder.append(component.eIsSet(LibraryPackage.Literals.COMPONENT__DESCRIPTION) ? " description:" + component.getDescription() : ""); componentCell.setCellValue(builder.toString()); }
From source file:com.netxforge.netxstudio.server.logic.reporting.ResourceReportingEngine.java
License:Open Source License
public Row rowForIndex(Sheet sheet, int rowIndex) { Row tsRow = sheet.getRow(rowIndex);/* www . j av a 2s. c om*/ if (tsRow == null) { tsRow = sheet.createRow(rowIndex); } return tsRow; }