Apache POI HWPF Nested Lists?
- by Mahadevan
Hi,
I used the following code to read list structures from a word file using hwpf. My question is how to read a list structure that is nested ie a list within a list within a list and so on.
if (p instanceof ListEntry) {
ListEntry entry = (ListEntry) p;
outText = entry.text();
outText = "<li>" + outText + "</li>";
// verifca prima e ultimo
if (i > 1) {
pPrev = range.getParagraph(i - 1);
if (!(pPrev instanceof ListEntry))
outText = "<ul>" + outText;
}
if (i < nParagrafi - 1) {
pNext = range.getParagraph(i + 1);
if (!(pNext instanceof ListEntry))
outText = outText + "</ul>";
}
if (i == nParagrafi - 1) {
outText = outText + "</ul>";
}