Package org.apache.poi.hwpf.model

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


        // with PAPX reconstruction
        assertEquals( 36, pDefs.size() );

    // Check that the last paragraph ends where it should do
    assertEquals(531, u.getOverallRange().text().length());
    PAPX pLast = pDefs.get(34);
//    assertEquals(530, pLast.getEnd());

    // Only care about the first few really though
    PAPX p0 = pDefs.get(0);
    PAPX p1 = pDefs.get(1);
    PAPX p2 = pDefs.get(2);
    PAPX p3 = pDefs.get(3);
    PAPX p4 = pDefs.get(4);

    // 5 paragraphs should get us to the end of our text
    assertTrue(p0.getStart() < 408);
    assertTrue(p0.getEnd() < 408);
    assertTrue(p1.getStart() < 408);
    assertTrue(p1.getEnd() < 408);
    assertTrue(p2.getStart() < 408);
    assertTrue(p2.getEnd() < 408);
    assertTrue(p3.getStart() < 408);
    assertTrue(p3.getEnd() < 408);
    assertTrue(p4.getStart() < 408);
    assertTrue(p4.getEnd() < 408);

    // Paragraphs should match with lines
    assertEquals(
        0,
        p0.getStart()
View Full Code Here


    HWPFDocument daDoc = HWPFTestDataSamples.openSampleFile(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

    HWPFDocument daDoc = HWPFTestDataSamples.openSampleFile(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

    @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

      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

            if ( parStart >= _paragraphs.size() )
            {
                return null;
            }

            PAPX papx = _paragraphs.get( point[0] );
            istd = papx.getIstd();
        }

        CharacterRun chp = new CharacterRun( chpx, _doc.getStyleSheet(), istd,
                this );
View Full Code Here

        if ( index + _parStart >= _parEnd )
            throw new IndexOutOfBoundsException( "Paragraph #" + index + " ("
                    + (index + _parStart) + ") not in range [" + _parStart
                    + "; " + _parEnd + ")" );

    PAPX papx = _paragraphs.get(index + _parStart);
    return Paragraph.newParagraph( this, papx );
  }
View Full Code Here

        }
        if ( _parRangeFound )
        {
            for ( int p = _parStart; p < _parEnd; p++ )
            {
                PAPX papx = _paragraphs.get( p );

                int left = Math.max( this._start, papx.getStart() );
                int right = Math.min( this._end, papx.getEnd() );

                if ( left >= right )
                    throw new AssertionError();
            }
        }
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

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.