Example usage for org.apache.poi.xslf.usermodel XSLFRelation SLIDE_MASTER

List of usage examples for org.apache.poi.xslf.usermodel XSLFRelation SLIDE_MASTER

Introduction

In this page you can find the example usage for org.apache.poi.xslf.usermodel XSLFRelation SLIDE_MASTER.

Prototype

XSLFRelation SLIDE_MASTER

To view the source code for org.apache.poi.xslf.usermodel XSLFRelation SLIDE_MASTER.

Click Source Link

Usage

From source file:org.apache.tika.parser.microsoft.ooxml.SXSLFPowerPointExtractorDecorator.java

License:Apache License

/**
 * @see XSLFPowerPointExtractor#getText()
 *//*w  ww.jav  a  2  s.co  m*/
protected void buildXHTML(XHTMLContentHandler xhtml) throws SAXException, IOException {

    loadCommentAuthors();

    //TODO: should check for custShowLst and order based on sldLst
    try {

        PackageRelationshipCollection prc = mainDocument
                .getRelationshipsByType(XSLFRelation.SLIDE.getRelation());
        if (prc.size() == 0) {

        }
        for (int i = 0; i < prc.size(); i++) {
            handleSlidePart(mainDocument.getRelatedPart(prc.getRelationship(i)), xhtml);
        }
    } catch (InvalidFormatException e) {
    }
    handleBasicRelatedParts(XSLFRelation.SLIDE_MASTER.getRelation(), "slide-master", mainDocument,
            new PlaceHolderSkipper(new OOXMLWordAndPowerPointTextHandler(new OOXMLTikaBodyPartHandler(xhtml),
                    new HashMap<String, String>())));

    handleBasicRelatedParts(HANDOUT_MASTER, "slide-handout-master", mainDocument,
            new OOXMLWordAndPowerPointTextHandler(new OOXMLTikaBodyPartHandler(xhtml),
                    new HashMap<String, String>()));
}

From source file:org.apache.tika.parser.microsoft.ooxml.SXSLFPowerPointExtractorDecorator.java

License:Apache License

/**
 * In PowerPoint files, slides have things embedded in them,
 * and slide drawings which have the images
 *///from w w w .ja  v  a 2s  .  c om
@Override
protected List<PackagePart> getMainDocumentParts() {
    List<PackagePart> parts = new ArrayList<>();
    //TODO: consider: getPackage().getPartsByName(Pattern.compile("/ppt/embeddings/.*?
    //TODO: consider: getPackage().getPartsByName(Pattern.compile("/ppt/media/.*?
    try {
        PackageRelationshipCollection prc = mainDocument
                .getRelationshipsByType(XSLFRelation.SLIDE.getRelation());
        for (int i = 0; i < prc.size(); i++) {
            PackagePart slidePart = mainDocument.getRelatedPart(prc.getRelationship(i));
            addSlideParts(slidePart, parts);
        }
    } catch (InvalidFormatException e) {
        //log
    }

    parts.add(mainDocument);
    for (String rel : new String[] { XSLFRelation.SLIDE_MASTER.getRelation(), HANDOUT_MASTER }) {
        try {
            PackageRelationshipCollection prc = mainDocument.getRelationshipsByType(rel);
            for (int i = 0; i < prc.size(); i++) {
                PackagePart pp = mainDocument.getRelatedPart(prc.getRelationship(i));
                if (pp != null) {
                    parts.add(pp);
                }
            }

        } catch (InvalidFormatException e) {
            //log
        }
    }

    return parts;
}