Examples of XWPFHeaderFooterPolicy


Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

     * @see org.apache.poi.xwpf.extractor.XWPFWordExtractor#getText()
     */
    @Override
    protected void buildXHTML(XHTMLContentHandler xhtml)
            throws SAXException, XmlException, IOException {
        XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy();

        // headers
        if (hfPolicy!=null) {
            extractHeaders(xhtml, hfPolicy);
        }
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

    private void extractParagraph(XWPFParagraph paragraph, XHTMLContentHandler xhtml)
            throws SAXException, XmlException, IOException {
       // If this paragraph is actually a whole new section, then
       //  it could have its own headers and footers
       // Check and handle if so
       XWPFHeaderFooterPolicy headerFooterPolicy = null;
       if (paragraph.getCTP().getPPr() != null) {
           CTSectPr ctSectPr = paragraph.getCTP().getPPr().getSectPr();
           if(ctSectPr != null) {
              headerFooterPolicy =
                  new XWPFHeaderFooterPolicy(document, ctSectPr);
              extractHeaders(xhtml, headerFooterPolicy);
           }
       }
      
       // Is this a paragraph, or a heading?
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

                }
            }
     
            // Sort out headers and footers
      if (doc.getDocument().getBody().getSectPr() != null)
        headerFooterPolicy = new XWPFHeaderFooterPolicy(this);
       
      // Create for each XML-part in the Package a PartClass
            for(POIXMLDocumentPart p : getRelations()){
                String relation = p.getPackageRelationship().getRelationshipType();
                if(relation.equals(XWPFRelation.STYLES.getRelation())){
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

            }
            cursor.dispose();

            // Sort out headers and footers
            if (doc.getDocument().getBody().getSectPr() != null)
                headerFooterPolicy = new XWPFHeaderFooterPolicy(this);

            // Create for each XML-part in the Package a PartClass
            for (POIXMLDocumentPart p : getRelations()) {
                String relation = p.getPackageRelationship().getRelationshipType();
                if (relation.equals(XWPFRelation.STYLES.getRelation())) {
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

    System.out.println(extractor.getText());
  }
 
    public String getText() {
        StringBuffer text = new StringBuffer();
        XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy();

        // Start out with all headers
        extractHeaders(text, hfPolicy);

        // Process all body elements
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

          CTSectPr ctSectPr = null;
          if (paragraph.getCTP().getPPr()!=null) {
              ctSectPr = paragraph.getCTP().getPPr().getSectPr();
          }

          XWPFHeaderFooterPolicy headerFooterPolicy = null;

          if (ctSectPr!=null) {
              headerFooterPolicy = new XWPFHeaderFooterPolicy(document, ctSectPr);
              extractHeaders(text, headerFooterPolicy);
          }


          for(IRunElement run : paragraph.getRuns()) {
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

        XWPFDocument readBack = XWPFTestDataSamples.writeOutAndReadBack(sampleDoc);
        verifyOneHeaderPicture(readBack);
    }

    private void verifyOneHeaderPicture(XWPFDocument sampleDoc) {
        XWPFHeaderFooterPolicy policy = sampleDoc.getHeaderFooterPolicy();

        XWPFHeader header = policy.getDefaultHeader();

        List<XWPFPictureData> pictures = header.getAllPictures();
        assertEquals(1,pictures.size());
    }
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

       
    }

    public void testBug51770() throws InvalidFormatException, IOException {
        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug51170.docx");
        XWPFHeaderFooterPolicy policy = doc.getHeaderFooterPolicy();
        XWPFHeader header = policy.getDefaultHeader();
        for (XWPFParagraph paragraph : header.getParagraphs()) {
            for (XWPFRun run : paragraph.getRuns()) {
                for (XWPFPicture picture : run.getEmbeddedPictures()) {
                    if (paragraph.getDocument() != null) {
                        //System.out.println(picture.getCTPicture());
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

        XWPFDocument readBack = XWPFTestDataSamples.writeOutAndReadBack(sampleDoc);
        verifyOneHeaderPicture(readBack);
    }

    private void verifyOneHeaderPicture(XWPFDocument sampleDoc) {
        XWPFHeaderFooterPolicy policy = sampleDoc.getHeaderFooterPolicy();

        XWPFHeader header = policy.getDefaultHeader();

        List<XWPFPictureData> pictures = header.getAllPictures();
        assertEquals(1,pictures.size());
    }
View Full Code Here

Examples of org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

       
    }

    public void testBug51770() throws InvalidFormatException, IOException {
        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug51170.docx");
        XWPFHeaderFooterPolicy policy = doc.getHeaderFooterPolicy();
        XWPFHeader header = policy.getDefaultHeader();
        for (XWPFParagraph paragraph : header.getParagraphs()) {
            for (XWPFRun run : paragraph.getRuns()) {
                for (XWPFPicture picture : run.getEmbeddedPictures()) {
                    if (paragraph.getDocument() != null) {
                        //System.out.println(picture.getCTPicture());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.