List of usage examples for org.apache.poi.ss.usermodel Row getLastCellNum
short getLastCellNum();
From source file:com.netxforge.netxstudio.models.export.MasterDataExporterRevenge.java
License:Open Source License
private void _generateCell(EReference eReference, Sheet sheet) { // Generate name. {/*from ww w . j ava 2s. co m*/ // Style, cell color. CellStyle referenceStyle = workBook.createCellStyle(); referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font HSSFFont referenceFont = workBook.createFont(); referenceFont.setFontName("Verdana"); referenceFont.setColor(HSSFColor.DARK_RED.index); 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.java
License:Open Source License
private void _generateMultiReferenceSource(EClass eClass, Sheet sheet) { // Generate name. {/*from w ww. j a va 2 s .com*/ // Style, cell color. CellStyle referenceStyle = workBook.createCellStyle(); referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font HSSFFont referenceFont = workBook.createFont(); referenceFont.setFontName("Verdana"); referenceFont.setColor(HSSFColor.DARK_RED.index); 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.java
License:Open Source License
private void _generateMultiRefCell(EReference eReference, Sheet sheet) { // Generate name. {/*www.j a v a2 s . c om*/ // Style, cell color. CellStyle referenceStyle = workBook.createCellStyle(); referenceStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); referenceStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); // Style, font HSSFFont referenceFont = workBook.createFont(); referenceFont.setFontName("Verdana"); referenceFont.setColor(HSSFColor.DARK_RED.index); 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 _generateID(Sheet sheet) { // Generate name. {/* w w w . jav a 2 s.c o m*/ // 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. {/*from w ww . ja va 2 s. c o m*/ // 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. j a v a 2 s .com*/ // 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. {/* ww w. j a v a 2 s . c om*/ // 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 w w w. j av a2s .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.RFSServiceDashboardReportingLogic.java
License:Open Source License
/** * Write each NodeType into a separate column, starting from the * <code>NODETYPE_ROW</code> */// ww w .j a va 2 s. c o m @Override protected void writeContent(Sheet sheet, NodeType nodeType) { Row ntRow = sheet.getRow(NODETYPE_ROW); if (ntRow == null) { ntRow = sheet.createRow(NODETYPE_ROW); } Cell ntCell = null; if (ntRow.getLastCellNum() == -1) { // This is our first node type. ntCell = ntRow.createCell(NODE_COLUMN); } else { ntCell = ntRow.createCell(ntRow.getLastCellNum() + 3); } if (ntCell != null) { ntCell.setCellValue(nodeType.getName()); } }
From source file:com.ocs.dynamo.importer.impl.BaseXlsImporter.java
License:Apache License
/** * Checks if any cell in the row contains a certain (String) value * //from w w w .ja va2s . com * @param row * @param value * @return */ protected boolean containsStringValue(Row row, String value) { if (row == null || !row.iterator().hasNext()) { return false; } boolean found = false; for (int i = row.getFirstCellNum(); !found && i < row.getLastCellNum(); i++) { if (row.getCell(i) != null) { try { found = value.equalsIgnoreCase(row.getCell(i).getStringCellValue()); } catch (Exception ex) { // do nothing } } } return found; }