https://bz.apache.org/bugzilla/show_bug.cgi?id=59324

            Bug ID: 59324
           Summary: Unable to get a list within a table that is removed
                    when 'Track Changes' is enabled
           Product: POI
           Version: 3.13-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HWPF
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 33762
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33762&action=edit
Sample document to reproduce the issue

When processing a Word Document with 'Track Changes' enabled, when trying to
get a list within a table, we get the following exception.
Sample file is attached and code is as follows

CODE:

import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFDocumentCore;
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
import org.apache.poi.hwpf.usermodel.HWPFList;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.io.FileInputStream;

public class PoiIssues {

    public static void main(String[] args) throws Exception {
        File file = new File("C:\\word-doc-revised-with-row-removed.doc");
        FileInputStream fileInputStream = new FileInputStream(file);
        Document document =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        WordToHtmlConverter wordToHtmlConverter = new
MyWordToHtmlConverter(document);
        HWPFDocumentCore hwpfDocumentCore = new
HWPFDocument(HWPFDocumentCore.verifyAndBuildPOIFS(fileInputStream));
        wordToHtmlConverter.processDocument(hwpfDocumentCore);
        System.out.println(document.toString());
        System.out.println("Process Complete");
    }

    public static class MyWordToHtmlConverter extends WordToHtmlConverter {
        public MyWordToHtmlConverter(Document document) {
            super(document);
        }

        @Override
        protected void processParagraph( HWPFDocumentCore hwpfDocument,
                                         Element parentElement, int
currentTableLevel, Paragraph paragraph,
                                         String bulletText )
        {
            super.processParagraph(hwpfDocument, parentElement,
currentTableLevel, paragraph, bulletText);
            HWPFList list = paragraph.getList();
            System.out.println("List " + list);
        }
    }
}

EXCEPTION : 

Exception in thread "main" java.util.NoSuchElementException: LFO with ilfo 47
not found. lfoMac is 38
    at org.apache.poi.hwpf.model.PlfLfo.getLfo(PlfLfo.java:174)
    at org.apache.poi.hwpf.model.ListTables.getLfo(ListTables.java:125)
    at org.apache.poi.hwpf.usermodel.HWPFList.<init>(HWPFList.java:92)
    at org.apache.poi.hwpf.usermodel.Paragraph.getList(Paragraph.java:607)
    at PoiIssues$MyWordToHtmlConverter.processParagraph(PoiIssues.java:39)
    at
org.apache.poi.hwpf.converter.AbstractWordConverter.processParagraphes(AbstractWordConverter.java:1111)
    at
org.apache.poi.hwpf.converter.WordToHtmlConverter.processTable(WordToHtmlConverter.java:683)
    at
org.apache.poi.hwpf.converter.AbstractWordConverter.processParagraphes(AbstractWordConverter.java:1073)
    at
org.apache.poi.hwpf.converter.WordToHtmlConverter.processSingleSection(WordToHtmlConverter.java:608)
    at
org.apache.poi.hwpf.converter.AbstractWordConverter.processDocument(AbstractWordConverter.java:721)
    at PoiIssues.main(PoiIssues.java:23)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to