Search in sources :

Example 1 with HWPFList

use of org.apache.poi.hwpf.usermodel.HWPFList in project poi by apache.

the class AbstractWordConverter method processParagraphes.

protected void processParagraphes(HWPFDocumentCore wordDocument, Element flow, Range range, int currentTableLevel) {
    final int paragraphs = range.numParagraphs();
    for (int p = 0; p < paragraphs; p++) {
        Paragraph paragraph = range.getParagraph(p);
        if (paragraph.isInTable() && paragraph.getTableLevel() != currentTableLevel) {
            if (paragraph.getTableLevel() < currentTableLevel)
                throw new IllegalStateException("Trying to process table cell with higher level (" + paragraph.getTableLevel() + ") than current table level (" + currentTableLevel + ") as inner table part");
            Table table = range.getTable(paragraph);
            processTable(wordDocument, flow, table);
            p += table.numParagraphs();
            p--;
            continue;
        }
        if (paragraph.text().equals("")) {
            processPageBreak(wordDocument, flow);
        }
        boolean processed = false;
        if (paragraph.isInList()) {
            try {
                HWPFList hwpfList = paragraph.getList();
                String label = AbstractWordUtils.getBulletText(numberingState, hwpfList, (char) paragraph.getIlvl());
                processParagraph(wordDocument, flow, currentTableLevel, paragraph, label);
                processed = true;
            } catch (Exception exc) {
                log.log(POILogger.WARN, "Can't process paragraph as list entry, will be processed without list information", exc);
            }
        }
        if (processed == false) {
            processParagraph(wordDocument, flow, currentTableLevel, paragraph, AbstractWordUtils.EMPTY);
        }
    }
}
Also used : Table(org.apache.poi.hwpf.usermodel.Table) HWPFList(org.apache.poi.hwpf.usermodel.HWPFList) Paragraph(org.apache.poi.hwpf.usermodel.Paragraph)

Aggregations

HWPFList (org.apache.poi.hwpf.usermodel.HWPFList)1 Paragraph (org.apache.poi.hwpf.usermodel.Paragraph)1 Table (org.apache.poi.hwpf.usermodel.Table)1