dump text runs
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1143837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
78a951143f
commit
a69d691581
@ -29,6 +29,7 @@ import org.apache.poi.hwpf.HWPFDocument;
|
|||||||
import org.apache.poi.hwpf.HWPFDocumentCore;
|
import org.apache.poi.hwpf.HWPFDocumentCore;
|
||||||
import org.apache.poi.hwpf.HWPFOldDocument;
|
import org.apache.poi.hwpf.HWPFOldDocument;
|
||||||
import org.apache.poi.hwpf.OldWordFileFormatException;
|
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.FileInformationBlock;
|
||||||
import org.apache.poi.hwpf.model.PAPX;
|
import org.apache.poi.hwpf.model.PAPX;
|
||||||
import org.apache.poi.hwpf.model.TextPiece;
|
import org.apache.poi.hwpf.model.TextPiece;
|
||||||
@ -84,6 +85,7 @@ public final class HWPFLister
|
|||||||
System.err
|
System.err
|
||||||
.println( "\tHWPFLister <filename>\n"
|
.println( "\tHWPFLister <filename>\n"
|
||||||
+ "\t\t[--textPieces] [--textPiecesText]\n"
|
+ "\t\t[--textPieces] [--textPiecesText]\n"
|
||||||
|
+ "\t\t[--textRuns] [--textRunsSprms]\n"
|
||||||
+ "\t\t[--papx] [--papxProperties]\n"
|
+ "\t\t[--papx] [--papxProperties]\n"
|
||||||
+ "\t\t[--paragraphs] [--paragraphsSprms] [--paragraphsText]\n"
|
+ "\t\t[--paragraphs] [--paragraphsSprms] [--paragraphsText]\n"
|
||||||
+ "\t\t[--writereadback]\n" );
|
+ "\t\t[--writereadback]\n" );
|
||||||
@ -93,6 +95,9 @@ public final class HWPFLister
|
|||||||
boolean outputTextPieces = false;
|
boolean outputTextPieces = false;
|
||||||
boolean outputTextPiecesText = false;
|
boolean outputTextPiecesText = false;
|
||||||
|
|
||||||
|
boolean outputTextRuns = false;
|
||||||
|
boolean outputTextRunsSprms = false;
|
||||||
|
|
||||||
boolean outputParagraphs = false;
|
boolean outputParagraphs = false;
|
||||||
boolean outputParagraphsSprms = false;
|
boolean outputParagraphsSprms = false;
|
||||||
boolean outputParagraphsText = false;
|
boolean outputParagraphsText = false;
|
||||||
@ -109,6 +114,11 @@ public final class HWPFLister
|
|||||||
if ( "--textPiecesText".equals( arg ) )
|
if ( "--textPiecesText".equals( arg ) )
|
||||||
outputTextPiecesText = true;
|
outputTextPiecesText = true;
|
||||||
|
|
||||||
|
if ( "--textRuns".equals( arg ) )
|
||||||
|
outputTextRuns = true;
|
||||||
|
if ( "--textRunsSprms".equals( arg ) )
|
||||||
|
outputTextRunsSprms = true;
|
||||||
|
|
||||||
if ( "--paragraphs".equals( arg ) )
|
if ( "--paragraphs".equals( arg ) )
|
||||||
outputParagraphs = true;
|
outputParagraphs = true;
|
||||||
if ( "--paragraphsSprms".equals( arg ) )
|
if ( "--paragraphsSprms".equals( arg ) )
|
||||||
@ -138,6 +148,12 @@ public final class HWPFLister
|
|||||||
lister.dumpTextPieces( outputTextPiecesText );
|
lister.dumpTextPieces( outputTextPiecesText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( outputTextRuns )
|
||||||
|
{
|
||||||
|
System.out.println( "== Text runs ==" );
|
||||||
|
lister.dumpTextRuns( outputTextRunsSprms );
|
||||||
|
}
|
||||||
|
|
||||||
if ( outputParagraphs )
|
if ( outputParagraphs )
|
||||||
{
|
{
|
||||||
System.out.println( "== Paragraphs ==" );
|
System.out.println( "== Paragraphs ==" );
|
||||||
@ -220,6 +236,23 @@ public final class HWPFLister
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 )
|
public void dumpTextPieces( boolean withText )
|
||||||
{
|
{
|
||||||
for ( TextPiece textPiece : _doc.getTextTable().getTextPieces() )
|
for ( TextPiece textPiece : _doc.getTextTable().getTextPieces() )
|
||||||
|
Loading…
Reference in New Issue
Block a user