Search in sources :

Example 1 with XSLFSlideShow

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();
}
Also used : XMLSlideShow(org.apache.poi.xslf.usermodel.XMLSlideShow) XSLFSlideShow(org.apache.poi.xslf.usermodel.XSLFSlideShow)

Example 2 with XSLFSlideShow

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();
}
Also used : POIXMLTextExtractor(org.apache.poi.POIXMLTextExtractor) XSLFSlideShow(org.apache.poi.xslf.usermodel.XSLFSlideShow)

Example 3 with XSLFSlideShow

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();
}
Also used : XSLFSlideShow(org.apache.poi.xslf.usermodel.XSLFSlideShow) OPCPackage(org.apache.poi.openxml4j.opc.OPCPackage)

Example 4 with XSLFSlideShow

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();
}
Also used : XSLFSlideShow(org.apache.poi.xslf.usermodel.XSLFSlideShow) CTSlideIdListEntry(org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdListEntry) CTSlideMasterIdListEntry(org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdListEntry) Test(org.junit.Test)

Example 5 with XSLFSlideShow

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();
}
Also used : CoreProperties(org.apache.poi.POIXMLProperties.CoreProperties) XSLFSlideShow(org.apache.poi.xslf.usermodel.XSLFSlideShow) CTProperties(org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties) Test(org.junit.Test)

Aggregations

XSLFSlideShow (org.apache.poi.xslf.usermodel.XSLFSlideShow)7 Test (org.junit.Test)3 IOException (java.io.IOException)1 CoreProperties (org.apache.poi.POIXMLProperties.CoreProperties)1 POIXMLTextExtractor (org.apache.poi.POIXMLTextExtractor)1 OpenXML4JException (org.apache.poi.openxml4j.exceptions.OpenXML4JException)1 OPCPackage (org.apache.poi.openxml4j.opc.OPCPackage)1 PackagePart (org.apache.poi.openxml4j.opc.PackagePart)1 PackageRelationshipCollection (org.apache.poi.openxml4j.opc.PackageRelationshipCollection)1 XDGFVisioExtractor (org.apache.poi.xdgf.extractor.XDGFVisioExtractor)1 XSLFPowerPointExtractor (org.apache.poi.xslf.extractor.XSLFPowerPointExtractor)1 XMLSlideShow (org.apache.poi.xslf.usermodel.XMLSlideShow)1 XSLFRelation (org.apache.poi.xslf.usermodel.XSLFRelation)1 XSSFBEventBasedExcelExtractor (org.apache.poi.xssf.extractor.XSSFBEventBasedExcelExtractor)1 XSSFEventBasedExcelExtractor (org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor)1 XSSFExcelExtractor (org.apache.poi.xssf.extractor.XSSFExcelExtractor)1 XSSFRelation (org.apache.poi.xssf.usermodel.XSSFRelation)1 XWPFWordExtractor (org.apache.poi.xwpf.extractor.XWPFWordExtractor)1 XWPFRelation (org.apache.poi.xwpf.usermodel.XWPFRelation)1 XmlException (org.apache.xmlbeans.XmlException)1