Package org.apache.poi.hwpf.model

Examples of org.apache.poi.hwpf.model.PAPX


    HWPFDocument daDoc = new HWPFDocument(new FileInputStream(illustrativeDocFile));
    Range range;
    Section section;
    Paragraph para;
    PAPX paraDef;

    // First, check overall
    range = daDoc.getOverallRange();
    assertEquals(1, range.numSections());
    assertEquals(5, range.numParagraphs());
   
   
    // Now, onto just the doc bit
    range = daDoc.getRange();

    assertEquals(1, range.numSections());
    assertEquals(1, daDoc.getSectionTable().getSections().size());
    section = range.getSection(0);
   
    assertEquals(5, section.numParagraphs());
   
    para = section.getParagraph(0);
    assertEquals(1, para.numCharacterRuns());
    assertEquals(introText, para.text());
   
    para = section.getParagraph(1);
    assertEquals(5, para.numCharacterRuns());
    assertEquals(fillerText, para.text());
   
   
    paraDef = (PAPX)daDoc.getParagraphTable().getParagraphs().get(2);
    assertEquals(132, paraDef.getStart());
    assertEquals(400, paraDef.getEnd());
   
    para = section.getParagraph(2);
    assertEquals(5, para.numCharacterRuns());
    assertEquals(originalText, para.text());
   
   
    paraDef = (PAPX)daDoc.getParagraphTable().getParagraphs().get(3);
    assertEquals(400, paraDef.getStart());
    assertEquals(438, paraDef.getEnd());
   
    para = section.getParagraph(3);
    assertEquals(1, para.numCharacterRuns());
    assertEquals(lastText, para.text());
   
View Full Code Here


   */
  public CharacterRun insertBefore(String text, CharacterProperties props)
  // throws UnsupportedEncodingException
  {
    initAll();
    PAPX papx = _paragraphs.get(_parStart);
    short istd = papx.getIstd();

    StyleSheet ss = _doc.getStyleSheet();
    CharacterProperties baseStyle = ss.getCharacterStyle(istd);
    byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
    SprmBuffer buf = new SprmBuffer(grpprl);
View Full Code Here

   */
  public CharacterRun insertAfter(String text, CharacterProperties props)
  // throws UnsupportedEncodingException
  {
    initAll();
    PAPX papx = _paragraphs.get(_parEnd - 1);
    short istd = papx.getIstd();

    StyleSheet ss = _doc.getStyleSheet();
    CharacterProperties baseStyle = ss.getCharacterStyle(istd);
    byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
    SprmBuffer buf = new SprmBuffer(grpprl);
View Full Code Here

      CHPX chpx = _characters.get(x);
      chpx.adjustForDelete(_start, _end - _start);
    }

    for (int x = _parStart; x < numParagraphs; x++) {
      PAPX papx = _paragraphs.get(x);
      // System.err.println("Paragraph " + x + " was " + papx.getStart() +
      // " -> " + papx.getEnd());
      papx.adjustForDelete(_start, _end - _start);
      // System.err.println("Paragraph " + x + " is now " +
      // papx.getStart() + " -> " + papx.getEnd());
    }

    for (int x = _sectionStart; x < numSections; x++) {
View Full Code Here

            return null;
        }

    int[] point = findRange(_paragraphs, _parStart, Math.max(chpx.getStart(), _start), chpx
        .getEnd());
    PAPX papx = _paragraphs.get(point[0]);
    short istd = papx.getIstd();

    CharacterRun chp = new CharacterRun(chpx, _doc.getStyleSheet(), istd, this);

    return chp;
  }
View Full Code Here

   * @return The paragraph at the specified index in this range.
   */

  public Paragraph getParagraph(int index) {
    initParagraphs();
    PAPX papx = _paragraphs.get(index + _parStart);

    ParagraphProperties props = papx.getParagraphProperties(_doc.getStyleSheet());
    Paragraph pap = null;
    if (props.getIlfo() > 0) {
      pap = new ListEntry(papx, this, _doc.getListTables());
    } else {
            if (((index + _parStart)==0) && papx.getStart()>0) {
                pap = new Paragraph(papx, this, 0);
            } else {
          pap = new Paragraph(papx, this);
            }
    }
View Full Code Here

  protected SprmBuffer _papx;

  protected Paragraph(int startIdx, int endIdx, Table parent)
  {
    super(startIdx, endIdx, Range.TYPE_PARAGRAPH, parent);
    PAPX papx = (PAPX)_paragraphs.get(_parEnd - 1);
    _props = papx.getParagraphProperties(_doc.getStyleSheet());
    _papx = papx.getSprmBuf();
    _istd = papx.getIstd();
  }
View Full Code Here

            Table parent )
    {
        super( startIdxInclusive, endIdxExclusive, parent );

        initAll();
        PAPX papx = _paragraphs.get( _parEnd - 1 );
        _props = papx.getParagraphProperties( _doc.getStyleSheet() );
        _papx = papx.getSprmBuf();
        _istd = papx.getIstd();
    }
View Full Code Here

    @Deprecated
  public CharacterRun insertBefore(String text, CharacterProperties props)
  // throws UnsupportedEncodingException
  {
    initAll();
    PAPX papx = _paragraphs.get(_parStart);
    short istd = papx.getIstd();

    StyleSheet ss = _doc.getStyleSheet();
    CharacterProperties baseStyle = ss.getCharacterStyle(istd);
    byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
    SprmBuffer buf = new SprmBuffer(grpprl, 0);
View Full Code Here

    @Deprecated
  public CharacterRun insertAfter(String text, CharacterProperties props)
  // throws UnsupportedEncodingException
  {
    initAll();
    PAPX papx = _paragraphs.get(_parEnd - 1);
    short istd = papx.getIstd();

    StyleSheet ss = _doc.getStyleSheet();
    CharacterProperties baseStyle = ss.getCharacterStyle(istd);
    byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
    SprmBuffer buf = new SprmBuffer(grpprl, 0);
View Full Code Here

TOP

Related Classes of org.apache.poi.hwpf.model.PAPX

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.