Java Code Examples for org.apache.poi.hssf.usermodel.HSSFSheet#removeRow()
The following examples show how to use
org.apache.poi.hssf.usermodel.HSSFSheet#removeRow() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AllTriggerSheetGenerator.java From ermaster-b with Apache License 2.0 | 4 votes |
@Override public void generate(IProgressMonitor monitor, HSSFWorkbook workbook, int sheetNo, boolean useLogicalNameAsSheetName, Map<String, Integer> sheetNameMap, Map<String, ObjectModel> sheetObjectMap, ERDiagram diagram, Map<String, LoopDefinition> loopDefinitionMap) { LoopDefinition loopDefinition = loopDefinitionMap.get(this .getTemplateSheetName()); HSSFSheet newSheet = createNewSheet(workbook, sheetNo, loopDefinition.sheetName, sheetNameMap); sheetObjectMap.put(workbook.getSheetName(workbook .getSheetIndex(newSheet)), diagram.getDiagramContents() .getTriggerSet()); HSSFSheet oldSheet = workbook.getSheetAt(sheetNo); boolean first = true; for (Trigger trigger : diagram.getDiagramContents().getTriggerSet()) { if (first) { first = false; } else { POIUtils .copyRow(oldSheet, newSheet, loopDefinition.startLine - 1, oldSheet .getLastRowNum(), newSheet .getLastRowNum() + loopDefinition.spaceLine + 1); } this.setTriggerData(workbook, newSheet, trigger); newSheet.setRowBreak(newSheet.getLastRowNum() + loopDefinition.spaceLine); monitor.worked(1); } if (first) { for (int i = loopDefinition.startLine - 1; i <= newSheet .getLastRowNum(); i++) { HSSFRow row = newSheet.getRow(i); if (row != null) { newSheet.removeRow(row); } } } }
Example 2
Source File: AllTablesSheetGenerator.java From ermaster-b with Apache License 2.0 | 4 votes |
@Override public void generate(IProgressMonitor monitor, HSSFWorkbook workbook, int sheetNo, boolean useLogicalNameAsSheetName, Map<String, Integer> sheetNameMap, Map<String, ObjectModel> sheetObjectMap, ERDiagram diagram, Map<String, LoopDefinition> loopDefinitionMap) { this.clear(); LoopDefinition loopDefinition = loopDefinitionMap.get(this .getTemplateSheetName()); HSSFSheet newSheet = createNewSheet(workbook, sheetNo, loopDefinition.sheetName, sheetNameMap); sheetObjectMap.put(workbook.getSheetName(workbook .getSheetIndex(newSheet)), new TableSet()); HSSFSheet oldSheet = workbook.getSheetAt(sheetNo); List<ERTable> tableContents = null; if (diagram.getCurrentCategory() != null) { tableContents = diagram.getCurrentCategory().getTableContents(); } else { tableContents = diagram.getDiagramContents().getContents() .getTableSet().getList(); } boolean first = true; for (ERTable table : tableContents) { if (first) { first = false; } else { POIUtils .copyRow(oldSheet, newSheet, loopDefinition.startLine - 1, oldSheet .getLastRowNum(), newSheet .getLastRowNum() + loopDefinition.spaceLine + 1); } this.setTableData(workbook, newSheet, table); newSheet.setRowBreak(newSheet.getLastRowNum() + loopDefinition.spaceLine); monitor.worked(1); } if (first) { for (int i = loopDefinition.startLine - 1; i <= newSheet .getLastRowNum(); i++) { HSSFRow row = newSheet.getRow(i); if (row != null) { newSheet.removeRow(row); } } } }
Example 3
Source File: AllViewSheetGenerator.java From ermaster-b with Apache License 2.0 | 4 votes |
@Override public void generate(IProgressMonitor monitor, HSSFWorkbook workbook, int sheetNo, boolean useLogicalNameAsSheetName, Map<String, Integer> sheetNameMap, Map<String, ObjectModel> sheetObjectMap, ERDiagram diagram, Map<String, LoopDefinition> loopDefinitionMap) { this.clear(); LoopDefinition loopDefinition = loopDefinitionMap.get(this .getTemplateSheetName()); HSSFSheet newSheet = createNewSheet(workbook, sheetNo, loopDefinition.sheetName, sheetNameMap); sheetObjectMap.put(workbook.getSheetName(workbook .getSheetIndex(newSheet)), diagram.getDiagramContents() .getContents().getViewSet()); HSSFSheet oldSheet = workbook.getSheetAt(sheetNo); boolean first = true; for (View view : diagram.getDiagramContents().getContents() .getViewSet()) { if (first) { first = false; } else { POIUtils .copyRow(oldSheet, newSheet, loopDefinition.startLine - 1, oldSheet .getLastRowNum(), newSheet .getLastRowNum() + loopDefinition.spaceLine + 1); } this.setViewData(workbook, newSheet, view); newSheet.setRowBreak(newSheet.getLastRowNum() + loopDefinition.spaceLine); monitor.worked(1); } if (first) { for (int i = loopDefinition.startLine - 1; i <= newSheet .getLastRowNum(); i++) { HSSFRow row = newSheet.getRow(i); if (row != null) { newSheet.removeRow(row); } } } }
Example 4
Source File: AllSequencesSheetGenerator.java From ermaster-b with Apache License 2.0 | 4 votes |
@Override public void generate(IProgressMonitor monitor, HSSFWorkbook workbook, int sheetNo, boolean useLogicalNameAsSheetName, Map<String, Integer> sheetNameMap, Map<String, ObjectModel> sheetObjectMap, ERDiagram diagram, Map<String, LoopDefinition> loopDefinitionMap) { LoopDefinition loopDefinition = loopDefinitionMap.get(this .getTemplateSheetName()); HSSFSheet newSheet = createNewSheet(workbook, sheetNo, loopDefinition.sheetName, sheetNameMap); sheetObjectMap.put(workbook.getSheetName(workbook .getSheetIndex(newSheet)), diagram.getDiagramContents() .getSequenceSet()); HSSFSheet oldSheet = workbook.getSheetAt(sheetNo); boolean first = true; for (Sequence sequence : diagram.getDiagramContents().getSequenceSet()) { if (first) { first = false; } else { POIUtils .copyRow(oldSheet, newSheet, loopDefinition.startLine - 1, oldSheet .getLastRowNum(), newSheet .getLastRowNum() + loopDefinition.spaceLine + 1); } this.setSequenceData(workbook, newSheet, sequence); newSheet.setRowBreak(newSheet.getLastRowNum() + loopDefinition.spaceLine); monitor.worked(1); } if (first) { for (int i = loopDefinition.startLine - 1; i <= newSheet .getLastRowNum(); i++) { HSSFRow row = newSheet.getRow(i); if (row != null) { newSheet.removeRow(row); } } } }
Example 5
Source File: AllIndicesSheetGenerator.java From ermaster-b with Apache License 2.0 | 4 votes |
@Override public void generate(IProgressMonitor monitor, HSSFWorkbook workbook, int sheetNo, boolean useLogicalNameAsSheetName, Map<String, Integer> sheetNameMap, Map<String, ObjectModel> sheetObjectMap, ERDiagram diagram, Map<String, LoopDefinition> loopDefinitionMap) { this.clear(); LoopDefinition loopDefinition = loopDefinitionMap.get(this .getTemplateSheetName()); HSSFSheet newSheet = createNewSheet(workbook, sheetNo, loopDefinition.sheetName, sheetNameMap); sheetObjectMap.put(workbook.getSheetName(workbook .getSheetIndex(newSheet)), diagram.getDiagramContents() .getIndexSet()); HSSFSheet oldSheet = workbook.getSheetAt(sheetNo); boolean first = true; for (ERTable table : diagram.getDiagramContents().getContents() .getTableSet()) { if (diagram.getCurrentCategory() != null && !diagram.getCurrentCategory().contains(table)) { continue; } for (Index index : table.getIndexes()) { if (first) { first = false; } else { POIUtils.copyRow(oldSheet, newSheet, loopDefinition.startLine - 1, oldSheet .getLastRowNum(), newSheet.getLastRowNum() + loopDefinition.spaceLine + 1); } this.setIndexData(workbook, newSheet, index); newSheet.setRowBreak(newSheet.getLastRowNum() + loopDefinition.spaceLine); monitor.worked(1); } } if (first) { for (int i = loopDefinition.startLine - 1; i <= newSheet .getLastRowNum(); i++) { HSSFRow row = newSheet.getRow(i); if (row != null) { newSheet.removeRow(row); } } } }