Package org.apache.poi.hwpf.usermodel

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


  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.getRange();
    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 Range getOverallRange() {
    // hack to get the ending cp of the document, Have to revisit this.
      PropertyNode p =  _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1);

      return new Range(0, p.getEnd(), this);
  }
View Full Code Here

    // First up, trigger a full-recalculate
    // Needed in case of deletes etc
    getOverallRange();

    // Now, return the real one
    return new Range(
        _cpSplit.getMainDocumentStart(),
        _cpSplit.getMainDocumentEnd(),
        this
      );
  }
View Full Code Here

  /**
   * Returns the range which covers all the Footnotes.
   */
  public Range getFootnoteRange() {
    return new Range(
        _cpSplit.getFootnoteStart(),
        _cpSplit.getFootnoteEnd(),
        this
      );
  }
View Full Code Here

  /**
   * Returns the range which covers all the Endnotes.
  */
  public Range getEndnoteRange() {
          return new Range(
                          _cpSplit.getEndNoteStart(),
                          _cpSplit.getEndNoteEnd(),
                          this
      );
  }
View Full Code Here

  /**
   * Returns the range which covers all the Endnotes.
  */
  public Range getCommentsRange() {
          return new Range(
                          _cpSplit.getCommentsStart(),
                          _cpSplit.getCommentsEnd(),
                          this
      );
  }
View Full Code Here

   * Returns the range which covers all "Header Stories".
   * A header story contains a header, footer, end note
   *  separators and footnote separators.
   */
  public Range getHeaderStoryRange() {
    return new Range(
        _cpSplit.getHeaderStoryStart(),
        _cpSplit.getHeaderStoryEnd(),
        this
      );
  }
View Full Code Here

    return _lt.addList(list.getListData(), list.getOverride());
  }

  public void delete(int start, int length)
  {
    Range r = new Range(start, start + length, this);
    r.delete();
  }
View Full Code Here

  {

    try
    {
      HWPFDocument doc = new HWPFDocument(new FileInputStream(args[0]));
      Range r = doc.getRange();
      String str = r.text();
      int x = 0;
//      CharacterRun run = new CharacterRun();
//      run.setBold(true);
//      run.setItalic(true);
//      run.setCapitalized(true);
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.