I have a Docx with a multilevel ordered lists: Bug2.zip (4.4 KB)
As you could see the first level has a format of x.
(x is a number)
the second is x.y.
(x & y are numbers)
while the third is an order list of type a (lowercase letters)
When converted to HTML using Aspose, third level items have both prefixes the one from the third level concatenated to the one from the second level (a. 1.2. )
When introspecting the generated HTML/CSS, I see that the style uses counter and increment them for all order list descendants:
.awlist1 {
list-style-type:none;
counter-reset:awlistcounter1
}
.awlist1 li:before {
content:'1.' counter(awlistcounter1) '.';
counter-increment:awlistcounter1
}
The selector used is .awlist1 li:before
which selects all descendants, while we need to add this prefix only to direct descendants (so we could use .awlist1 > li:before
instead)
The code I used to convert DOCX to HTML:
// Load the document.
Document doc = new Document(dataDir + String.format(INPUT, name));
HtmlSaveOptions options = new HtmlSaveOptions();
options.setExportListLabels(ExportListLabels.BY_HTML_TAGS);
options.setExportPageMargins(true);
options.setExportPageSetup(true);
doc.save(dataDir + String.format(HTML, name), options);
Any help please ?