use of org.apache.poi.ss.usermodel.Workbook in project poi by apache.
the class TestXSSFSheetRowGrouping method test55640.
//private int o_groupsNumber = 0;
public void test55640() throws IOException {
//long startTime = System.currentTimeMillis();
Workbook wb = new XSSFWorkbook();
fillData(wb);
writeToFile(wb);
//System.out.println("Number of groups: " + o_groupsNumber);
//System.out.println("Execution time: " + (System.currentTimeMillis()-startTime) + " ms");
}
use of org.apache.poi.ss.usermodel.Workbook in project poi by apache.
the class TestXSSFSheetRowGrouping method verifyGroupCollapsedSpec.
private void verifyGroupCollapsedSpec(boolean level1, boolean level2, boolean level3, Boolean[] collapsed, boolean[] hidden, int[] outlineLevel) throws IOException {
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet("sheet123");
for (int i = 5; i < 9; i++) {
sheet.createRow(i);
}
sheet.groupRow(5, 6);
sheet.groupRow(5, 7);
sheet.groupRow(5, 8);
sheet.setRowGroupCollapsed(6, level1);
sheet.setRowGroupCollapsed(7, level2);
sheet.setRowGroupCollapsed(8, level3);
checkWorkbookGrouping(wb, collapsed, hidden, outlineLevel);
}
use of org.apache.poi.ss.usermodel.Workbook in project poi by apache.
the class TestXSSFSheet method testRemoveRowWithCommentAndGapAbove.
// bug 59687: XSSFSheet.RemoveRow doesn't handle row gaps properly when removing row comments
@Test
public void testRemoveRowWithCommentAndGapAbove() throws IOException {
final Workbook wb = _testDataProvider.openSampleWorkbook("59687.xlsx");
final Sheet sheet = wb.getSheetAt(0);
// comment exists
CellAddress commentCellAddress = new CellAddress("A4");
assertNotNull(sheet.getCellComment(commentCellAddress));
assertEquals("Wrong starting # of comments", 1, sheet.getCellComments().size());
sheet.removeRow(sheet.getRow(commentCellAddress.getRow()));
assertEquals("There should not be any comments left!", 0, sheet.getCellComments().size());
}
use of org.apache.poi.ss.usermodel.Workbook in project poi by apache.
the class TestXSSFSheetRowGrouping method verifyGroupCollapsed.
private void verifyGroupCollapsed(boolean level1, boolean level2, boolean level3, Boolean[] collapsed, boolean[] hidden, int[] outlineLevel) throws IOException {
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet("sheet123");
for (int i = 0; i < 4; i++) {
sheet.createRow(i);
}
sheet.groupRow(0, 4);
sheet.groupRow(1, 4);
sheet.groupRow(2, 4);
sheet.setRowGroupCollapsed(0, level1);
sheet.setRowGroupCollapsed(1, level2);
sheet.setRowGroupCollapsed(2, level3);
checkWorkbookGrouping(wb, collapsed, hidden, outlineLevel);
}
use of org.apache.poi.ss.usermodel.Workbook in project poi by apache.
the class TestXSSFSheetShiftRows method testBug53798a.
/** negative row shift causes corrupted data or throws exception */
@Test
public void testBug53798a() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("53798.xlsx");
Sheet testSheet = wb.getSheetAt(0);
testSheet.shiftRows(3, 3, -1);
for (Row r : testSheet) {
r.getRowNum();
}
testSheet.shiftRows(6, 6, 1);
Workbook read = XSSFTestDataSamples.writeOutAndReadBack(wb);
wb.close();
assertNotNull(read);
Sheet readSheet = read.getSheetAt(0);
verifyCellContent(readSheet, 0, "0.0");
verifyCellContent(readSheet, 1, "1.0");
verifyCellContent(readSheet, 2, "3.0");
verifyCellContent(readSheet, 3, null);
verifyCellContent(readSheet, 4, "4.0");
verifyCellContent(readSheet, 5, "5.0");
verifyCellContent(readSheet, 6, null);
verifyCellContent(readSheet, 7, "6.0");
verifyCellContent(readSheet, 8, "8.0");
read.close();
}
Aggregations