use of org.apache.poi.hwpf.model.PlexOfCps in project poi by apache.
the class HWPFLister method dumpPapx.
public void dumpPapx(boolean withProperties, boolean withSprms) throws Exception {
if (_doc instanceof HWPFDocument) {
System.out.println("binary PAP pages ");
HWPFDocument doc = (HWPFDocument) _doc;
byte[] mainStream = _doc.getMainStream();
PlexOfCps binTable = new PlexOfCps(doc.getTableStream(), doc.getFileInformationBlock().getFcPlcfbtePapx(), doc.getFileInformationBlock().getLcbPlcfbtePapx(), 4);
List<PAPX> papxs = new ArrayList<PAPX>();
int length = binTable.length();
for (int x = 0; x < length; x++) {
GenericPropertyNode node = binTable.getProperty(x);
int pageNum = LittleEndian.getInt(node.getBytes());
int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum;
PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(mainStream, doc.getDataStream(), pageOffset, doc.getTextTable());
System.out.println("* PFKP: " + pfkp);
for (PAPX papx : pfkp.getPAPXs()) {
System.out.println("** " + papx);
papxs.add(papx);
if (papx != null && withSprms) {
SprmIterator sprmIt = new SprmIterator(papx.getGrpprl(), 2);
dumpSprms(sprmIt, "*** ");
}
}
}
Collections.sort(papxs);
System.out.println("* Sorted by END");
for (PAPX papx : papxs) {
System.out.println("** " + papx);
if (papx != null && withSprms) {
SprmIterator sprmIt = new SprmIterator(papx.getGrpprl(), 2);
dumpSprms(sprmIt, "*** ");
}
}
}
for (PAPX papx : _doc.getParagraphTable().getParagraphs()) {
System.out.println(papx);
if (withProperties) {
Paragraph paragraph = Paragraph.newParagraph(_doc.getOverallRange(), papx);
System.out.println(paragraph.getProps());
}
SprmIterator sprmIt = new SprmIterator(papx.getGrpprl(), 2);
dumpSprms(sprmIt, "\t");
}
}
Aggregations