Package org.apache.poi.hwpf.usermodel

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


        docUnicode._cpSplit.getHeaderStoryEnd()
    );
  }

  public void testContentsUnicode() {
    Range r;

    // Now check the real ranges
    r = docUnicode.getRange();
    assertEquals(
        u_page_1 +
        page_break + "\r" +
        u_page_2,
        r.text()
    );

    r = docUnicode.getHeaderStoryRange();
    assertEquals(
        headerDef +
        u_header +
        footerDef +
        u_footer +
        endHeaderFooter,
        r.text()
    );

    r = docUnicode.getOverallRange();
    assertEquals(
        u_page_1 +
        page_break + "\r" +
        u_page_2 +
        headerDef +
        u_header +
        footerDef +
        u_footer +
        endHeaderFooter +
        "\r",
        r.text()
    );
  }
View Full Code Here


        public String[] getParagraphText() {
                String[] ret;

                // Extract using the model code
                try {
                        Range r = doc.getRange();

                        ret = getParagraphText(r);
                } catch (Exception e) {
                        // Something's up with turning the text pieces into paragraphs
                        // Fall back to ripping out the text pieces
View Full Code Here

                return ret;
        }

        public String[] getFootnoteText() {
                Range r = doc.getFootnoteRange();

                return getParagraphText(r);
        }
View Full Code Here

                return getParagraphText(r);
        }

        public String[] getEndnoteText() {
                Range r = doc.getEndnoteRange();

                return getParagraphText(r);
        }
View Full Code Here

                return getParagraphText(r);
        }

        public String[] getCommentsText() {
                Range r = doc.getCommentsRange();

                return getParagraphText(r);
        }
View Full Code Here

   * @return a list of Picture objects found in current document
   */
  public List getAllPictures() {
    ArrayList pictures = new ArrayList();

    Range range = _document.getOverallRange();
    for (int i = 0; i < range.numCharacterRuns(); i++) {
      CharacterRun run = range.getCharacterRun(i);
      String text = run.text();
      Picture picture = extractPicture(run, false);
      if (picture != null) {
        pictures.add(picture);
      }
View Full Code Here

  public String[] getParagraphText() {
    String[] ret;
   
    // Extract using the model code
    try {
        Range r = doc.getRange();

      ret = new String[r.numParagraphs()];
      for(int i=0; i<ret.length; i++) {
        Paragraph p = r.getParagraph(i);
        ret[i] = p.text();
       
        // Fix the line ending
        if(ret[i].endsWith("\r")) {
          ret[i] = ret[i] + "\n";
View Full Code Here

   * @return a list of Picture objects found in current document
   */
  public List getAllPictures() {
    ArrayList pictures = new ArrayList();

    Range range = _document.getOverallRange();
    for (int i = 0; i < range.numCharacterRuns(); i++) {
      CharacterRun run = range.getCharacterRun(i);
      String text = run.text();
      Picture picture = extractPicture(run, false);
      if (picture != null) {
        pictures.add(picture);
      }
View Full Code Here

  public String[] getParagraphText() {
    String[] ret;
   
    // Extract using the model code
    try {
        Range r = doc.getRange();

      ret = new String[r.numParagraphs()];
      for(int i=0; i<ret.length; i++) {
        Paragraph p = r.getParagraph(i);
        ret[i] = p.text();
       
        // Fix the line ending
        if(ret[i].endsWith("\r")) {
          ret[i] = ret[i] + "\n";
View Full Code Here

     * ListEntry passed no ListTable
     */
    public void testListEntryNoListTable() throws Exception {
      HWPFDocument doc = new HWPFDocument(new FileInputStream(dirname + "/ListEntryNoListTable.doc"));
     
      Range r = doc.getRange();
      StyleSheet styleSheet = doc.getStyleSheet();
      for (int x = 0; x < r.numSections(); x++) {
        Section s = r.getSection(x);
        for (int y = 0; y < s.numParagraphs(); y++) {
          Paragraph paragraph = s.getParagraph(y);
          //System.out.println(paragraph.getCharacterRun(0).text());
        }
      }
View Full Code Here

TOP

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

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.