use of org.apache.poi.openxml4j.opc.OPCPackage in project poi by apache.
the class TestXSSFReader method test50119.
/**
* Iterating over a workbook with chart sheets in it, using the
* XSSFReader method
* @throws Exception
*/
public void test50119() throws Exception {
OPCPackage pkg = XSSFTestDataSamples.openSamplePackage("WithChartSheet.xlsx");
XSSFReader r = new XSSFReader(pkg);
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
while (it.hasNext()) {
InputStream stream = it.next();
stream.close();
}
}
use of org.apache.poi.openxml4j.opc.OPCPackage in project poi by apache.
the class TestXSSFReader method testBug57914.
public void testBug57914() throws Exception {
OPCPackage pkg = XSSFTestDataSamples.openSamplePackage("57914.xlsx");
final XSSFReader r;
// this test as well
try {
r = new XSSFReader(pkg);
fail("This will fail until bug 57699 is fixed");
} catch (POIXMLException e) {
assertContains(e.getMessage(), "57699");
return;
}
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
String text = getShapesString(it);
assertContains(text, "Line 1");
assertContains(text, "Line 2");
assertContains(text, "Line 3");
}
use of org.apache.poi.openxml4j.opc.OPCPackage in project poi by apache.
the class TestXSSFReader method testComments.
public void testComments() throws Exception {
OPCPackage pkg = XSSFTestDataSamples.openSamplePackage("comments.xlsx");
XSSFReader r = new XSSFReader(pkg);
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
int count = 0;
while (it.hasNext()) {
count++;
InputStream inp = it.next();
inp.close();
if (count == 1) {
assertNotNull(it.getSheetComments());
CommentsTable ct = it.getSheetComments();
assertEquals(1, ct.getNumberOfAuthors());
assertEquals(3, ct.getNumberOfComments());
} else {
assertNull(it.getSheetComments());
}
}
assertEquals(3, count);
}
use of org.apache.poi.openxml4j.opc.OPCPackage in project poi by apache.
the class TestXSSFReader method testStyles.
public void testStyles() throws Exception {
OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("SampleSS.xlsx"));
XSSFReader r = new XSSFReader(pkg);
assertEquals(3, r.getStylesTable().getFonts().size());
assertEquals(0, r.getStylesTable().getNumDataFormats());
// The Styles Table should have the themes associated with it too
assertNotNull(r.getStylesTable().getTheme());
// Check we get valid data for the two
assertNotNull(r.getStylesData());
assertNotNull(r.getThemesData());
}
use of org.apache.poi.openxml4j.opc.OPCPackage in project poi by apache.
the class TestXSSFReader method testGetBits.
public void testGetBits() throws Exception {
OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("SampleSS.xlsx"));
XSSFReader r = new XSSFReader(pkg);
assertNotNull(r.getWorkbookData());
assertNotNull(r.getSharedStringsData());
assertNotNull(r.getStylesData());
assertNotNull(r.getSharedStringsTable());
assertNotNull(r.getStylesTable());
}
Aggregations