We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Nested Ordered Lists numbers are changed after DOCX to HTML conversion using .NET

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 ?

@mohamed_hamdi

We have tested the scenario using the latest version of Aspose.Words for Java 20.10 and have not found the shared issue. So, please use Aspose.Words for Java 20.10. We have attached the output HTML with this post for your kind reference.
output.zip (570 Bytes)

@tahir.manzoor sorry but the zip you attached has the same problem
look at the third item it starts with an a. and then the 1.2.Hello Word

@mohamed_hamdi

We have logged this problem in our issue tracking system as WORDSNET-21370. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tahir.manzoor any news about this issue ?
did you have an eta ?

1 Like

@mohamed_hamdi

Unfortunately, the issue WORDSNET-21370 had been postponed (no estimate is available at the moment). We will inform you via this forum thread once there is an update available on it.

We apologize for your inconvenience.