use of org.apache.poi.hwpf.model.LFO in project poi by apache.
the class HWPFLister method dumpParagraphLevels.
protected void dumpParagraphLevels(ListTables listTables, ParagraphProperties paragraph) {
if (paragraph.getIlfo() != 0) {
final LFO lfo = listTables.getLfo(paragraph.getIlfo());
System.out.println("PAP's LFO: " + lfo);
final LFOData lfoData = listTables.getLfoData(paragraph.getIlfo());
System.out.println("PAP's LFOData: " + lfoData);
if (lfo != null) {
final ListLevel listLevel = listTables.getLevel(lfo.getLsid(), paragraph.getIlvl());
System.out.println("PAP's ListLevel: " + listLevel);
if (listLevel.getGrpprlPapx() != null) {
System.out.println("PAP's ListLevel PAPX:");
dumpSprms(new SprmIterator(listLevel.getGrpprlPapx(), 0), "* ");
}
if (listLevel.getGrpprlPapx() != null) {
System.out.println("PAP's ListLevel CHPX:");
dumpSprms(new SprmIterator(listLevel.getGrpprlChpx(), 0), "* ");
}
}
}
}
use of org.apache.poi.hwpf.model.LFO in project poi by apache.
the class TestBug50075 method test.
public void test() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug50075.doc");
Range range = doc.getRange();
assertEquals(1, range.numParagraphs());
ListEntry entry = (ListEntry) range.getParagraph(0);
LFO override = doc.getListTables().getLfo(entry.getIlfo());
ListLevel level = doc.getListTables().getLevel(override.getLsid(), entry.getIlvl());
// the bug reproduces, if this call fails with NullPointerException
level.getNumberText();
}
use of org.apache.poi.hwpf.model.LFO in project poi by apache.
the class Paragraph method newParagraph.
@Internal
public static Paragraph newParagraph(Range parent, PAPX papx) {
HWPFDocumentCore doc = parent._doc;
ListTables listTables = doc.getListTables();
StyleSheet styleSheet = doc.getStyleSheet();
ParagraphProperties properties = new ParagraphProperties();
properties.setIstd(papx.getIstd());
properties = newParagraph_applyStyleProperties(styleSheet, papx, properties);
properties = ParagraphSprmUncompressor.uncompressPAP(properties, papx.getGrpprl(), 2);
if (properties.getIlfo() != 0 && listTables != null) {
LFO lfo = null;
try {
lfo = listTables.getLfo(properties.getIlfo());
} catch (NoSuchElementException exc) {
log.log(POILogger.WARN, "Paragraph refers to LFO #", properties.getIlfo(), " that does not exists");
}
if (lfo != null) {
final ListLevel listLevel = listTables.getLevel(lfo.getLsid(), properties.getIlvl());
if (listLevel != null && listLevel.getGrpprlPapx() != null) {
properties = ParagraphSprmUncompressor.uncompressPAP(properties, listLevel.getGrpprlPapx(), 0);
// reapply style and local PAPX properties
properties = newParagraph_applyStyleProperties(styleSheet, papx, properties);
properties = ParagraphSprmUncompressor.uncompressPAP(properties, papx.getGrpprl(), 2);
}
}
}
if (properties.getIlfo() > 0)
return new ListEntry(papx, properties, parent);
return new Paragraph(papx, properties, parent);
}
Aggregations