Package org.apache.poi.hwpf.usermodel

Examples of org.apache.poi.hwpf.usermodel.HeaderStories


            parseWord6(root, xhtml);
            return;
        }
        org.apache.poi.hwpf.extractor.WordExtractor wordExtractor =
            new org.apache.poi.hwpf.extractor.WordExtractor(document);
        HeaderStories headerFooter = new HeaderStories(document);

        // Grab the list of pictures. As far as we can tell,
        //  the pictures should be in order, and may be directly
        //  placed or referenced from an anchor
        PicturesTable pictureTable = document.getPicturesTable();
        PicturesSource pictures = new PicturesSource(document);

        // Do any headers, if present
        Range[] headers = new Range[] { headerFooter.getFirstHeaderSubrange(),
                headerFooter.getEvenHeaderSubrange(), headerFooter.getOddHeaderSubrange() };
        handleHeaderFooter(headers, "header", document, pictures, pictureTable, xhtml);

        // Do the main paragraph text
        Range r = document.getRange();
        for(int i=0; i<r.numParagraphs(); i++) {
           Paragraph p = r.getParagraph(i);
           i += handleParagraph(p, 0, r, document, FieldsDocumentPart.MAIN, pictures, pictureTable, xhtml);
        }

        // Do everything else
        for (String paragraph: wordExtractor.getMainTextboxText()) {
            xhtml.element("p", paragraph);
        }

  for (String paragraph : wordExtractor.getFootnoteText()) {
            xhtml.element("p", paragraph);
        }

        for (String paragraph : wordExtractor.getCommentsText()) {
            xhtml.element("p", paragraph);
        }

        for (String paragraph : wordExtractor.getEndnoteText()) {
            xhtml.element("p", paragraph);
        }

        // Do any footers, if present
        Range[] footers = new Range[] { headerFooter.getFirstFooterSubrange(),
                headerFooter.getEvenFooterSubrange(), headerFooter.getOddFooterSubrange() };
        handleHeaderFooter(footers, "footer", document, pictures, pictureTable, xhtml);

        // Handle any pictures that we haven't output yet
        for(Picture p = pictures.nextUnclaimed(); p != null; ) {
           handlePictureCharacterRun(
View Full Code Here


  }
  /**
   * Grab the text from the headers
   */
  public String getHeaderText() {
    HeaderStories hs = new HeaderStories(doc);

    StringBuffer ret = new StringBuffer();
    if(hs.getFirstHeader() != null) {
      appendHeaderFooter(hs.getFirstHeader(), ret);
    }
    if(hs.getEvenHeader() != null) {
      appendHeaderFooter(hs.getEvenHeader(), ret);
    }
    if(hs.getOddHeader() != null) {
      appendHeaderFooter(hs.getOddHeader(), ret);
    }

    return ret.toString();
  }
View Full Code Here

  }
  /**
   * Grab the text from the footers
   */
  public String getFooterText() {
    HeaderStories hs = new HeaderStories(doc);

    StringBuffer ret = new StringBuffer();
    if(hs.getFirstFooter() != null) {
      appendHeaderFooter(hs.getFirstFooter(), ret);
    }
    if(hs.getEvenFooter() != null) {
      appendHeaderFooter(hs.getEvenFooter(), ret);
    }
    if(hs.getOddFooter() != null) {
      appendHeaderFooter(hs.getOddFooter(), ret);
    }

    return ret.toString();
  }
View Full Code Here

  }
  /**
   * Grab the text from the headers
   */
  public String getHeaderText() {
    HeaderStories hs = new HeaderStories(doc);
   
    StringBuffer ret = new StringBuffer();
    if(hs.getFirstHeader() != null) {
      appendHeaderFooter(hs.getFirstHeader(), ret);
    }
    if(hs.getEvenHeader() != null) {
      appendHeaderFooter(hs.getEvenHeader(), ret);
    }
    if(hs.getOddHeader() != null) {
      appendHeaderFooter(hs.getOddHeader(), ret);
    }
   
    return ret.toString();
  }
View Full Code Here

  }
  /**
   * Grab the text from the footers
   */
  public String getFooterText() {
    HeaderStories hs = new HeaderStories(doc);
   
    StringBuffer ret = new StringBuffer();
    if(hs.getFirstFooter() != null) {
      appendHeaderFooter(hs.getFirstFooter(), ret);
    }
    if(hs.getEvenFooter() != null) {
      appendHeaderFooter(hs.getEvenFooter(), ret);
    }
    if(hs.getOddFooter() != null) {
      appendHeaderFooter(hs.getOddFooter(), ret);
    }
   
    return ret.toString();
  }
View Full Code Here

  }
  /**
   * Grab the text from the headers
   */
  public String getHeaderText() {
    HeaderStories hs = new HeaderStories(doc);

    StringBuffer ret = new StringBuffer();
    if(hs.getFirstHeader() != null) {
      appendHeaderFooter(hs.getFirstHeader(), ret);
    }
    if(hs.getEvenHeader() != null) {
      appendHeaderFooter(hs.getEvenHeader(), ret);
    }
    if(hs.getOddHeader() != null) {
      appendHeaderFooter(hs.getOddHeader(), ret);
    }

    return ret.toString();
  }
View Full Code Here

  }
  /**
   * Grab the text from the footers
   */
  public String getFooterText() {
    HeaderStories hs = new HeaderStories(doc);

    StringBuffer ret = new StringBuffer();
    if(hs.getFirstFooter() != null) {
      appendHeaderFooter(hs.getFirstFooter(), ret);
    }
    if(hs.getEvenFooter() != null) {
      appendHeaderFooter(hs.getEvenFooter(), ret);
    }
    if(hs.getOddFooter() != null) {
      appendHeaderFooter(hs.getOddFooter(), ret);
    }

    return ret.toString();
  }
View Full Code Here

  }
  /**
   * Grab the text from the headers
   */
  public String getHeaderText() {
    HeaderStories hs = new HeaderStories(doc);

    StringBuffer ret = new StringBuffer();
    if(hs.getFirstHeader() != null) {
      appendHeaderFooter(hs.getFirstHeader(), ret);
    }
    if(hs.getEvenHeader() != null) {
      appendHeaderFooter(hs.getEvenHeader(), ret);
    }
    if(hs.getOddHeader() != null) {
      appendHeaderFooter(hs.getOddHeader(), ret);
    }

    return ret.toString();
  }
View Full Code Here

  }
  /**
   * Grab the text from the footers
   */
  public String getFooterText() {
    HeaderStories hs = new HeaderStories(doc);

    StringBuffer ret = new StringBuffer();
    if(hs.getFirstFooter() != null) {
      appendHeaderFooter(hs.getFirstFooter(), ret);
    }
    if(hs.getEvenFooter() != null) {
      appendHeaderFooter(hs.getEvenFooter(), ret);
    }
    if(hs.getOddFooter() != null) {
      appendHeaderFooter(hs.getOddFooter(), ret);
    }

    return ret.toString();
  }
View Full Code Here

     * Grab the text from the headers
     */
    @Deprecated
    public String getHeaderText()
    {
        HeaderStories hs = new HeaderStories( doc );

        StringBuffer ret = new StringBuffer();
        if ( hs.getFirstHeader() != null )
        {
            appendHeaderFooter( hs.getFirstHeader(), ret );
        }
        if ( hs.getEvenHeader() != null )
        {
            appendHeaderFooter( hs.getEvenHeader(), ret );
        }
        if ( hs.getOddHeader() != null )
        {
            appendHeaderFooter( hs.getOddHeader(), ret );
        }

        return ret.toString();
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hwpf.usermodel.HeaderStories

Copyright © 2018 www.massapicom. 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.