Package org.apache.poi.hwpf.usermodel

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


   * AIOOB for TableSprmUncompressor.unCompressTAPOperation
   */
  public void testSprmAIOOB() throws Exception {
      HWPFDocument doc = new HWPFDocument(new FileInputStream(dirname + "/AIOOB-Tap.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


    // Convert main document part

    MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
    org.docx4j.wml.ObjectFactory factory = new org.docx4j.wml.ObjectFactory();

    Range r = doc.getRange();

    for (int x = 0; x < r.numSections(); x++) {
      Section s = r.getSection(x);

      // TODO - convert section

      for (int y = 0; y < s.numParagraphs(); y++) {
        Paragraph p = s.getParagraph(y);
View Full Code Here

        //  placed or referenced from an anchor
        PicturesTable pictureTable = document.getPicturesTable();
        PicturesSource pictures = new PicturesSource(document);
       
        // 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, pictures, pictureTable, xhtml);
        }

        // Do everything else
        for (String paragraph : wordExtractor.getFootnoteText()) {
View Full Code Here

          // These are \u0008 escher floating ones, ones
          //  found outside the normal text, and who
          //  knows what else...
          nonU1based = new ArrayList<Picture>();
          nonU1based.addAll(all);
          Range r = doc.getRange();
          for(int i=0; i<r.numCharacterRuns(); i++) {
             CharacterRun cr = r.getCharacterRun(i);
             if(picturesTable.hasPicture(cr)) {
                Picture p = getFor(cr);
                int at = nonU1based.indexOf(p);
                nonU1based.set(at, null);
             }
View Full Code Here

      try
      {
        //Task:TODO Use a doc file of the project and adapt the temp directories
       
        HWPFDocument document = new HWPFDocument( new FileInputStream( "c:/temp/test.doc"));
        Range range = document.getRange();
        //range.delete();
        range.insertBefore("hallo christian");
          System.out.println("Example you supplied:");
          System.out.println("---------------------");
          for (int x = 0; x < range.numSections(); x++)
          {
            Section section = range.getSection(x);
            for (int y = 0; y < section.numParagraphs(); y++)
            {
              Paragraph paragraph = section.getParagraph(y);
              for (int z = 0; z < paragraph.numCharacterRuns(); z++)
              {
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

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

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

          ret = WordExtractor.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

        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

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.