List of usage examples for org.apache.poi.ss.usermodel Sheet removeRow
void removeRow(Row row);
From source file:org.squashtest.tm.service.internal.batchexport.RequirementExcelExporter.java
License:Open Source License
private void appendOneRequirement(Sheet reqSheet, int rowIndex, RequirementModel reqModel) { Row row = reqSheet.createRow(rowIndex); int colIndex = 0; try {//from www.j av a 2s .c o m row.createCell(colIndex++).setCellValue(reqModel.getProjectId()); row.createCell(colIndex++).setCellValue(reqModel.getProjectName()); row.createCell(colIndex++).setCellValue(reqModel.getPath()); row.createCell(colIndex++).setCellValue(reqModel.getRequirementIndex()); row.createCell(colIndex++).setCellValue(reqModel.getRequirementVersionNumber()); row.createCell(colIndex++).setCellValue(reqModel.getReference()); row.createCell(colIndex++).setCellValue(reqModel.getName()); row.createCell(colIndex++).setCellValue(reqModel.getCriticality().toString()); row.createCell(colIndex++).setCellValue(reqModel.getCategoryCode()); row.createCell(colIndex++).setCellValue(reqModel.getStatus().toString()); row.createCell(colIndex++).setCellValue(reqModel.getDescription()); row.createCell(colIndex++).setCellValue(reqModel.getRequirementVersionCoveragesSize()); row.createCell(colIndex++).setCellValue(reqModel.getAttachmentListSize()); row.createCell(colIndex++).setCellValue(format(reqModel.getCreatedOn())); row.createCell(colIndex++).setCellValue(reqModel.getCreatedBy()); row.createCell(colIndex++).setCellValue(format(reqModel.getLastModifiedOn())); row.createCell(colIndex++).setCellValue(reqModel.getLastModifiedBy()); if (milestonesEnabled) { row.createCell(colIndex++).setCellValue(reqModel.getMilestonesLabels()); } appendCustomFields(row, "REQ_VERSION_CUF_", reqModel.getCufs()); //call extension point and get the new column index in return colIndex = doOptionnalAppendRequirement(row, colIndex, reqModel); } catch (IllegalArgumentException wtf) { reqSheet.removeRow(row); row = reqSheet.createRow(rowIndex); row.createCell(0).setCellValue(errorCellTooLargeMessage); } }
From source file:org.teiid.translator.excel.ExcelUpdateExecution.java
License:Apache License
private void handleDelete() throws TranslatorException { while (true) { Row row = nextRow();//from ww w. j a v a2s. c o m if (row == null) { break; } this.rowIterator = null; int start = row.getRowNum(); Sheet sheet = row.getSheet(); int end = sheet.getLastRowNum(); //a different iteration style is needed, which will not perform as well for sparse documents for (int i = start; i <= end; i++) { row = sheet.getRow(i); if (row == null) { continue; } if (row.getFirstCellNum() == -1) { continue; } if (!this.visitor.allows(row.getRowNum())) { continue; } sheet.removeRow(row); result++; modified = true; } } }
From source file:org.tiefaces.components.websheet.configuration.ConfigurationHandler.java
License:MIT License
/** * check and repair the sheet's lastrow. If the row is blank then remove it. * * @param sheet/* w w w. j a va 2 s.c o m*/ * the sheet */ private final void checkAndRepairLastRow(final Sheet sheet) { // repair last row if it's inserted in the configuration generation Row lastrow = sheet.getRow(sheet.getLastRowNum()); // if it's lastrow and all the cells are blank. then remove the lastrow. if (lastrow != null) { for (Cell cell : lastrow) { if ((cell.getCellTypeEnum() != CellType._NONE) && (cell.getCellTypeEnum() != CellType.BLANK)) { return; } } sheet.removeRow(lastrow); } }
From source file:org.tiefaces.components.websheet.utility.CommandUtility.java
License:MIT License
/** * Removes the single row in sheet./*from w w w . ja v a2 s. c o m*/ * * @param sheet * the sheet * @param rowIndexStart * the row index start */ private static void removeSingleRowInSheet(final Sheet sheet, final int rowIndexStart) { Row removingRow = sheet.getRow(rowIndexStart); if (removingRow != null) { sheet.removeRow(removingRow); } }
From source file:org.wso2.carbon.dataservices.sql.driver.query.delete.ExcelDeleteQuery.java
License:Open Source License
private int executeSQL() throws SQLException { TExcelConnection excelCon = (TExcelConnection) getConnection(); //begin transaction, excelCon.beginExcelTransaction();/*from w w w . ja v a 2 s . co m*/ Sheet currentWorkSheet = excelCon.getWorkbook().getSheet(getTargetTableName()); for (Integer rowId : this.getResultantRows().keySet()) { currentWorkSheet.removeRow(currentWorkSheet.getRow(rowId + 1)); } TDriverUtil.writeRecords(excelCon.getWorkbook(), excelCon.getPath()); return this.getResultantRows().size(); }