Numbered lists in HTML export

I’m using Aspose.Word to convert .doc files to .html format, and am experiencing a couple of problems when the input file contained numbered lists. The HTML export converter seems to include an explicit “value” attribute in each <li> tag it generates. That is, rather than allowing the browser to number the list entries automatically, the export converter is generating <li value=1>, <li value=2>, etc. This leads to two problems:

  1. The numbers are assigned incorrectly for nested lists. Numbering is carried across at each level, instead of starting fresh for each sublist. For example, if you create a list like this in Word:

1
A
B
2
A
B

The resulting HTML file will look like this:

1
A
B
2
C
D

  1. If the user subsequently edits the HTML file, the list items don’t renumber properly, because they’re locked into their current values.

As a workaround, I’m ripping out the “value” attribute of each <li> tag in the output of the HTML converter. It seems like the HTML converter should not be generating these value attributes in the first place, except in the rare circumstance that the user had explicitly overridden the automatic numbering. Can this be fixed?

The main problem is that MS Word lists can come with all sorts of numbering styles and custom list labels that are not natively supported by HTML, for example “1.)”. Therefore it was easier for us to just always generate the list label before export.

The first issue you mentioned obviously needs fixing in Aspose.Word, it is sometimes hard to figure out from a Word file whether the list number should continue or restart, it works in most of the files in our testing. I will try to address this again.

The second issue is the result of Aspose.Word always generating the list number and I see it is a problem if the user needs to edit the HTML file. I might be able to add an option that specifies whether Aspose.Word should generate list numbers or leave it up to the browser. By setting this option you can get what you want, but you will obviously lose some of MS Word specific number types or custom list labels in the exported documents. What do you think?

The first issue you mentioned obviously needs fixing in Aspose.Words, it is sometimes hard to figure out from a Word file whether the list number should continue or restart, it works in most of the files in our testing. I will try to address this again.

The problem reproduces easily for me – just launch Word, create a new document, click the Numbered List icon, and create a multi-level list as described. I’m attaching a sample file that illustrates the problem.

I might be able to add an option that specifies whether Aspose.Words should generate list numbers or leave it up to the browser. By setting this option you> can get what you want, but you will obviously lose some of MS Word specific number types or custom list labels in the exported documents.

This would help a bit, but even better would be to generate list numbers only when needed. The default Word settings match the default browser settings pretty well. It’s true that there are many cases where you’d need to generate explicit list numbers to match Word, but in the most common case it’s not necessary. And often you can use a single “start” and/or “type” attribute on the
tag, or the more modern CSS equivalents, instead of hard-coding a “value” attribute on each

  1. This would allow reproducing many Word options while still allowing the document to be edited.

Thanks for the quick response!

The issues you have found earlier (filed as 538) have been fixed in this update.