use of org.apache.poi.xssf.XSSFTestDataSamples.openSampleWorkbook in project poi by apache.
the class TestXSSFSheet method runGetTopRow.
private void runGetTopRow(String file, boolean isXSSF, int... topRows) throws IOException {
final Workbook wb = (isXSSF) ? XSSFTestDataSamples.openSampleWorkbook(file) : HSSFTestDataSamples.openSampleWorkbook(file);
for (int si = 0; si < wb.getNumberOfSheets(); si++) {
Sheet sh = wb.getSheetAt(si);
assertNotNull(sh.getSheetName());
assertEquals("Did not match for sheet " + si, topRows[si], sh.getTopRow());
}
// for XSSF also test with SXSSF
if (isXSSF) {
Workbook swb = new SXSSFWorkbook((XSSFWorkbook) wb);
for (int si = 0; si < swb.getNumberOfSheets(); si++) {
Sheet sh = swb.getSheetAt(si);
assertNotNull(sh.getSheetName());
assertEquals("Did not match for sheet " + si, topRows[si], sh.getTopRow());
}
swb.close();
}
wb.close();
}
use of org.apache.poi.xssf.XSSFTestDataSamples.openSampleWorkbook in project poi by apache.
the class TestXSSFSheet method testInsertCommentsToClonedSheet.
/**
* See bug #52425
*/
@Test
public void testInsertCommentsToClonedSheet() {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("52425.xlsx");
CreationHelper helper = wb.getCreationHelper();
Sheet sheet2 = wb.createSheet("Sheet 2");
Sheet sheet3 = wb.cloneSheet(0);
wb.setSheetName(2, "Sheet 3");
// Adding Comment to new created Sheet 2
addComments(helper, sheet2);
// Adding Comment to cloned Sheet 3
addComments(helper, sheet3);
}
use of org.apache.poi.xssf.XSSFTestDataSamples.openSampleWorkbook in project poi by apache.
the class TestXSSFSheet method runGetLeftCol.
private void runGetLeftCol(String file, boolean isXSSF, int... topRows) throws IOException {
final Workbook wb = (isXSSF) ? XSSFTestDataSamples.openSampleWorkbook(file) : HSSFTestDataSamples.openSampleWorkbook(file);
for (int si = 0; si < wb.getNumberOfSheets(); si++) {
Sheet sh = wb.getSheetAt(si);
assertNotNull(sh.getSheetName());
assertEquals("Did not match for sheet " + si, topRows[si], sh.getLeftCol());
}
// for XSSF also test with SXSSF
if (isXSSF) {
Workbook swb = new SXSSFWorkbook((XSSFWorkbook) wb);
for (int si = 0; si < swb.getNumberOfSheets(); si++) {
Sheet sh = swb.getSheetAt(si);
assertNotNull(sh.getSheetName());
assertEquals("Did not match for sheet " + si, topRows[si], sh.getLeftCol());
}
swb.close();
}
wb.close();
}
Aggregations