List of usage examples for org.apache.poi.xwpf.usermodel XWPFRelation COMMENT
XWPFRelation COMMENT
To view the source code for org.apache.poi.xwpf.usermodel XWPFRelation COMMENT.
Click Source Link
From source file:org.apache.tika.parser.microsoft.ooxml.SXWPFWordExtractorDecorator.java
License:Apache License
private void handleDocumentPart(PackagePart documentPart, XHTMLContentHandler xhtml) throws IOException, SAXException { //load the numbering/list manager and styles from the main document part XWPFNumbering numbering = loadNumbering(documentPart); XWPFListManager listManager = new XWPFListManager(numbering); XWPFStylesShim styles = loadStyles(documentPart); //headers//www . j a v a2s . co m try { PackageRelationshipCollection headersPRC = documentPart .getRelationshipsByType(XWPFRelation.HEADER.getRelation()); if (headersPRC != null) { for (int i = 0; i < headersPRC.size(); i++) { PackagePart header = documentPart.getRelatedPart(headersPRC.getRelationship(i)); handlePart(header, styles, listManager, xhtml); } } } catch (InvalidFormatException e) { //swallow } //main document handlePart(documentPart, styles, listManager, xhtml); //for now, just dump other components at end for (XWPFRelation rel : new XWPFRelation[] { XWPFRelation.FOOTNOTE, XWPFRelation.COMMENT, XWPFRelation.FOOTER, XWPFRelation.ENDNOTE }) { try { PackageRelationshipCollection prc = documentPart.getRelationshipsByType(rel.getRelation()); if (prc != null) { for (int i = 0; i < prc.size(); i++) { PackagePart packagePart = documentPart.getRelatedPart(prc.getRelationship(i)); handlePart(packagePart, styles, listManager, xhtml); } } } catch (InvalidFormatException e) { //swallow } } }
From source file:org.apache.tika.parser.microsoft.ooxml.xwpf.XWPFEventBasedWordExtractor.java
License:Apache License
private void handleDocumentPart(PackagePart documentPart, StringBuilder sb) throws IOException, SAXException { //load the numbering/list manager and styles from the main document part XWPFNumbering numbering = loadNumbering(documentPart); XWPFListManager xwpfListManager = new XWPFListManager(numbering); //TODO: XWPFStyles styles = loadStyles(documentPart); //headers/*from w w w. ja va 2 s .c o m*/ try { PackageRelationshipCollection headersPRC = documentPart .getRelationshipsByType(XWPFRelation.HEADER.getRelation()); if (headersPRC != null) { for (int i = 0; i < headersPRC.size(); i++) { PackagePart header = documentPart.getRelatedPart(headersPRC.getRelationship(i)); handlePart(header, xwpfListManager, sb); } } } catch (InvalidFormatException e) { //swallow } //main document handlePart(documentPart, xwpfListManager, sb); //for now, just dump other components at end for (XWPFRelation rel : new XWPFRelation[] { XWPFRelation.FOOTNOTE, XWPFRelation.COMMENT, XWPFRelation.FOOTER, XWPFRelation.ENDNOTE }) { try { PackageRelationshipCollection prc = documentPart.getRelationshipsByType(rel.getRelation()); if (prc != null) { for (int i = 0; i < prc.size(); i++) { PackagePart packagePart = documentPart.getRelatedPart(prc.getRelationship(i)); handlePart(packagePart, xwpfListManager, sb); } } } catch (InvalidFormatException e) { //swallow } } }