use of org.apache.poi.xslf.usermodel.XSLFSlideShow in project poi by apache.
the class XSLFFileHandler method handleFile.
@Override
public void handleFile(InputStream stream, String path) throws Exception {
XMLSlideShow slide = new XMLSlideShow(stream);
XSLFSlideShow slideInner = new XSLFSlideShow(slide.getPackage());
assertNotNull(slideInner.getPresentation());
assertNotNull(slideInner.getSlideMasterReferences());
assertNotNull(slideInner.getSlideReferences());
new POIXMLDocumentHandler().handlePOIXMLDocument(slide);
handleSlideShow(slide);
slideInner.close();
slide.close();
}
use of org.apache.poi.xslf.usermodel.XSLFSlideShow in project poi by apache.
the class XSLFPowerPointExtractor method main.
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Use:");
System.err.println(" XSLFPowerPointExtractor <filename.pptx>");
System.exit(1);
}
POIXMLTextExtractor extractor = new XSLFPowerPointExtractor(new XSLFSlideShow(args[0]));
System.out.println(extractor.getText());
extractor.close();
}
use of org.apache.poi.xslf.usermodel.XSLFSlideShow in project poi by apache.
the class TestXMLPropertiesTextExtractor method testWithSomeNulls.
/**
* Bug #49386 - some properties, especially
* dates can be null
*/
public void testWithSomeNulls() throws Exception {
OPCPackage pkg = OPCPackage.open(_slSamples.openResourceAsStream("49386-null_dates.pptx"));
XSLFSlideShow sl = new XSLFSlideShow(pkg);
POIXMLPropertiesTextExtractor ext = new POIXMLPropertiesTextExtractor(sl);
ext.getText();
String text = ext.getText();
// With date is null
assertFalse(text.contains("Created ="));
// Via string is blank
assertContains(text, "CreatedString = ");
assertContains(text, "LastModifiedBy = IT Client Services");
ext.close();
}
use of org.apache.poi.xslf.usermodel.XSLFSlideShow in project poi by apache.
the class TestXSLFSlideShow method testSlideBasics.
@Test
public void testSlideBasics() throws IOException, OpenXML4JException, XmlException {
XSLFSlideShow xml = new XSLFSlideShow(pack);
// Should have 1 master
assertEquals(1, xml.getSlideMasterReferences().sizeOfSldMasterIdArray());
// Should have three sheets
assertEquals(2, xml.getSlideReferences().sizeOfSldIdArray());
// Check they're as expected
CTSlideIdListEntry[] slides = xml.getSlideReferences().getSldIdArray();
assertEquals(256, slides[0].getId());
assertEquals(257, slides[1].getId());
assertEquals("rId2", slides[0].getId2());
assertEquals("rId3", slides[1].getId2());
// Now get those objects
assertNotNull(xml.getSlide(slides[0]));
assertNotNull(xml.getSlide(slides[1]));
// And check they have notes as expected
assertNotNull(xml.getNotes(slides[0]));
assertNotNull(xml.getNotes(slides[1]));
// And again for the master
CTSlideMasterIdListEntry[] masters = xml.getSlideMasterReferences().getSldMasterIdArray();
// see SlideAtom.USES_MASTER_SLIDE_ID
assertEquals(0x80000000L, masters[0].getId());
assertEquals("rId1", masters[0].getId2());
assertNotNull(xml.getSlideMaster(masters[0]));
xml.close();
}
use of org.apache.poi.xslf.usermodel.XSLFSlideShow in project poi by apache.
the class TestXSLFSlideShow method testMetadataBasics.
@Test
public void testMetadataBasics() throws IOException, OpenXML4JException, XmlException {
XSLFSlideShow xml = new XSLFSlideShow(pack);
assertNotNull(xml.getProperties().getCoreProperties());
assertNotNull(xml.getProperties().getExtendedProperties());
CTProperties props = xml.getProperties().getExtendedProperties().getUnderlyingProperties();
assertEquals("Microsoft Office PowerPoint", props.getApplication());
assertEquals(0, props.getCharacters());
assertEquals(0, props.getLines());
CoreProperties cprops = xml.getProperties().getCoreProperties();
assertNull(cprops.getTitle());
assertNull(cprops.getUnderlyingProperties().getSubjectProperty().getValue());
xml.close();
}
Aggregations