public void dumpParagraphs( boolean dumpAssotiatedPapx ) { for ( Map.Entry<Integer, String> entry : paragraphs.entrySet() ) { Integer endOfParagraphCharOffset = entry.getKey(); System.out.println( "[...; " + ( endOfParagraphCharOffset + 1 ) + "): " + entry.getValue() ); if ( dumpAssotiatedPapx ) { boolean hasAssotiatedPapx = false; for ( PAPX papx : _doc.getParagraphTable().getParagraphs() ) { if ( papx.getStart() <= endOfParagraphCharOffset.intValue() && endOfParagraphCharOffset.intValue() < papx .getEnd() ) { hasAssotiatedPapx = true; System.out.println( "* " + papx ); SprmIterator sprmIt = new SprmIterator( papx.getGrpprl(), 2 ); dumpSprms( sprmIt, "** " ); } } if ( !hasAssotiatedPapx ) { System.out.println( "* " + "NO PAPX ASSOTIATED WITH PARAGRAPH!" ); } } } }
for ( PAPX papx : _doc.getParagraphTable().getParagraphs() )
/** * Inserts text into the front of this range. * * @param text * The text to insert * @return The character run that text was inserted into. */ public CharacterRun insertBefore( String text ) { initAll(); _text.insert( _start, text ); _doc.getCharacterTable().adjustForInsert( _charStart, text.length() ); _doc.getParagraphTable().adjustForInsert( _parStart, text.length() ); _doc.getSectionTable().adjustForInsert( _sectionStart, text.length() ); if ( _doc instanceof HWPFDocument ) { ( (BookmarksImpl) ( (HWPFDocument) _doc ).getBookmarks() ) .afterInsert( _start, text.length() ); } adjustForInsert( text.length() ); // update the FIB.CCPText + friends fields adjustFIB( text.length() ); sanityCheck(); return getCharacterRun( 0 ); }
/** * Inserts text into the front of this range. * * @param text * The text to insert * @return The character run that text was inserted into. */ public CharacterRun insertBefore( String text ) { initAll(); _text.insert( _start, text ); _doc.getCharacterTable().adjustForInsert( _charStart, text.length() ); _doc.getParagraphTable().adjustForInsert( _parStart, text.length() ); _doc.getSectionTable().adjustForInsert( _sectionStart, text.length() ); if ( _doc instanceof HWPFDocument ) { ( (BookmarksImpl) ( (HWPFDocument) _doc ).getBookmarks() ) .afterInsert( _start, text.length() ); } adjustForInsert( text.length() ); // update the FIB.CCPText + friends fields adjustFIB( text.length() ); assert sanityCheck(); return getCharacterRun( 0 ); }
/** * Inserts text onto the end of this range * * @param text * The text to insert * @return The character run the text was inserted into. */ public CharacterRun insertAfter( String text ) { initAll(); _text.insert( _end, text ); _doc.getCharacterTable().adjustForInsert( _charEnd - 1, text.length() ); _doc.getParagraphTable().adjustForInsert( _parEnd - 1, text.length() ); _doc.getSectionTable().adjustForInsert( _sectionEnd - 1, text.length() ); if ( _doc instanceof HWPFDocument ) { ( (BookmarksImpl) ( (HWPFDocument) _doc ).getBookmarks() ) .afterInsert( _end, text.length() ); } adjustForInsert( text.length() ); sanityCheck(); return getCharacterRun( numCharacterRuns() - 1 ); }
/** * Inserts text onto the end of this range * * @param text * The text to insert * @return The character run the text was inserted into. */ public CharacterRun insertAfter( String text ) { initAll(); _text.insert( _end, text ); _doc.getCharacterTable().adjustForInsert( _charEnd - 1, text.length() ); _doc.getParagraphTable().adjustForInsert( _parEnd - 1, text.length() ); _doc.getSectionTable().adjustForInsert( _sectionEnd - 1, text.length() ); if ( _doc instanceof HWPFDocument ) { ( (BookmarksImpl) ( (HWPFDocument) _doc ).getBookmarks() ) .afterInsert( _end, text.length() ); } adjustForInsert( text.length() ); assert sanityCheck(); return getCharacterRun( numCharacterRuns() - 1 ); }
_props.setAccessible( true ); for ( PAPX papx : _doc.getParagraphTable().getParagraphs() )
/** * Used to construct a Range from a document. This is generally used to * create a Range that spans the whole document, or at least one whole part * of the document (eg main text, header, comment) * * @param start * Starting character offset of the range. * @param end * Ending character offset of the range. * @param doc * The HWPFDocument the range is based on. */ public Range(int start, int end, HWPFDocumentCore doc) { _start = start; _end = end; _doc = doc; _sections = _doc.getSectionTable().getSections(); _paragraphs = _doc.getParagraphTable().getParagraphs(); _characters = _doc.getCharacterTable().getTextRuns(); _text = _doc.getText(); _parent = new WeakReference<Range>(null); sanityCheckStartEnd(); }
/** * Used to construct a Range from a document. This is generally used to * create a Range that spans the whole document, or at least one whole part * of the document (eg main text, header, comment) * * @param start * Starting character offset of the range. * @param end * Ending character offset of the range. * @param doc * The HWPFDocument the range is based on. */ public Range(int start, int end, HWPFDocumentCore doc) { _start = start; _end = end; _doc = doc; _sections = _doc.getSectionTable().getSections(); _paragraphs = _doc.getParagraphTable().getParagraphs(); _characters = _doc.getCharacterTable().getTextRuns(); _text = _doc.getText(); _parent = new WeakReference<>(null); sanityCheckStartEnd(); }
SprmBuffer buf = new SprmBuffer(withIndex, 2); _doc.getParagraphTable().insert(_parStart, _start, buf); insertBefore(text, baseChp); return getParagraph(0);
SprmBuffer buf = new SprmBuffer(withIndex, 2); _doc.getParagraphTable().insert(_parStart, _start, buf); insertBefore(text, baseChp); return getParagraph(0);
SprmBuffer buf = new SprmBuffer(withIndex, 2); _doc.getParagraphTable().insert(_parEnd, _end, buf); _parEnd++; insertAfter(text, baseChp);
SprmBuffer buf = new SprmBuffer(withIndex, 2); _doc.getParagraphTable().insert(_parEnd, _end, buf); _parEnd++; insertAfter(text, baseChp);
for ( PAPX papx : _doc.getParagraphTable().getParagraphs() ) { System.out.println( papx );