Word ordered lists to html

Hello,

I trying to convert a *docx file into html.

In numeric list, i have a strange results.

in docx:

Ordered list

  1. One. Bond item with text

  2. additionalList

2.1. a

2.2. b

2.3. c

  1. Two. Bond item with no bond text

  2. Three.

Other ordered list

1.1. OneOne

1.2. OneTwo

1.3. OneThree

in html:

Ordered list

  1. One. Bond item with text

  2. additionalList

1.a

2.b

3.c

3.Two. Bond item with no bond text

4.Three.

Other ordered list

1.OneOne

2.OneTwo

3.OneThree

Can i get ordered list with right numbers, if i use a ExportListLabels = ExportListLabels.ByHtmlTags, Option ?

As i mean, decimal numbers can be added in html with this styles:

OL { counter-reset: item }
LI { display: block }
LI:before { content: counters(item, ".") " "; counter-increment: item }
  • your solution supports this feature?

Hi Alexander,

Thanks for your inquiry. In your case, I suggest you please use ExportListLabels as AsInlineText or Auto to get the required output. Using ExportListLabels.ByHtmlTags output all list labels as HTML native elements. Please check the following code example for your kind reference. Hope this helps you.

If you face any issue, please share your input document here for testing. I will investigate the issue and provide you more information.

Document doc = new Document("in.docx");
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.Html);
// ExportListLabels.Auto is the default value of this option.
saveOptions.ExportListLabels = ExportListLabels.Auto;
doc.Save(@"test_auto.html", saveOptions);
// HTML <p> tag is used for any list label representation.
saveOptions.ExportListLabels = ExportListLabels.AsInlineText;
doc.Save(@"test_p.html", saveOptions);
// HTML <ul> and <ol> tags are used for list label representation. Some formatting loss is possible.
saveOptions.ExportListLabels = ExportListLabels.ByHtmlTags;
doc.Save(@"test_tags.html", saveOptions);

Hi, Tahir.
I tried this option, but i need an ordered html list is with correct numbers.
Can i get it ?

Hi Alexander,

Thanks for your inquiry. Your requirement can be achieved using counter-reset and counter-increment css properties with
tag. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we had already logged this feature request as WORDSNET-7662 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

Tahir, thanks

The issues you have found earlier (filed as WORDSNET-7662) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.