import org.apache.poi.hwpf.HWPFDocumentCore;
import org.apache.poi.hwpf.HWPFOldDocument;
import org.apache.poi.hwpf.OldWordFileFormatException;
+import org.apache.poi.hwpf.model.CHPX;
import org.apache.poi.hwpf.model.FileInformationBlock;
import org.apache.poi.hwpf.model.PAPX;
import org.apache.poi.hwpf.model.TextPiece;
System.err
.println( "\tHWPFLister <filename>\n"
+ "\t\t[--textPieces] [--textPiecesText]\n"
+ + "\t\t[--textRuns] [--textRunsSprms]\n"
+ "\t\t[--papx] [--papxProperties]\n"
+ "\t\t[--paragraphs] [--paragraphsSprms] [--paragraphsText]\n"
+ "\t\t[--writereadback]\n" );
boolean outputTextPieces = false;
boolean outputTextPiecesText = false;
+ boolean outputTextRuns = false;
+ boolean outputTextRunsSprms = false;
+
boolean outputParagraphs = false;
boolean outputParagraphsSprms = false;
boolean outputParagraphsText = false;
if ( "--textPiecesText".equals( arg ) )
outputTextPiecesText = true;
+ if ( "--textRuns".equals( arg ) )
+ outputTextRuns = true;
+ if ( "--textRunsSprms".equals( arg ) )
+ outputTextRunsSprms = true;
+
if ( "--paragraphs".equals( arg ) )
outputParagraphs = true;
if ( "--paragraphsSprms".equals( arg ) )
lister.dumpTextPieces( outputTextPiecesText );
}
+ if ( outputTextRuns )
+ {
+ System.out.println( "== Text runs ==" );
+ lister.dumpTextRuns( outputTextRunsSprms );
+ }
+
if ( outputParagraphs )
{
System.out.println( "== Paragraphs ==" );
}
}
+ public void dumpTextRuns( boolean withSprms )
+ {
+ for ( CHPX chpx : _doc.getCharacterTable().getTextRuns() )
+ {
+ System.out.println( chpx );
+
+ if ( withSprms )
+ {
+ SprmIterator sprmIt = new SprmIterator( chpx.getGrpprl(), 2 );
+ while ( sprmIt.hasNext() )
+ {
+ SprmOperation sprm = sprmIt.next();
+ System.out.println( "\t" + sprm.toString() );
+ }
+ }
+ }
+ }
public void dumpTextPieces( boolean withText )
{
for ( TextPiece textPiece : _doc.getTextTable().getTextPieces() )