Bullets and numbering alignment - Word to HTML conversion

Hi Hafeez,

Good day.
When i tried to convert the word to HTML using aspose, bullets and numbering are converting as ‘<p>’ tag instead of ‘<li>’, its totally affects the document alignment. can you please help me regarding this. Herewith i attached a sample document for your reference. Waiting for your reply.

Thanks and Regards,

Documents: List Type.zip (12.0 KB)


This Topic is created by awais.hafeez using the Email to Topic plugin.

@SM0767,

Please try using the following code:

Document doc = new Document(@"D:\Temp\List Type.docx");
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.Html);
opts.PrettyFormat = true;
opts.ExportListLabels = ExportListLabels.ByHtmlTags;
doc.Save("D:\\Temp\\18.6.html", opts); 

Hope, this helps.

Hi Hafeez,
Getting error on these lines. I’m using “aspose-words-18.6-jdk16.jar” this jar for conversion. Please advise me.Screenshot_1.jpg (22.0 KB)

@SM0767,

Please try using the following Java code:

Document doc = new Document("D:\\Temp\\List Type.docx");
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setPrettyFormat(true);
opts.setExportListLabels(ExportListLabels.BY_HTML_TAGS);
doc.save("D:\\Temp\\18.6.html", opts);

Hi Hafeez,

Thanks its working. But i’m not getting it exactly.
Here with i attached the screenshots for your reference.
Please advise me.

Word.jpeg —> Actual word image Word.jpg (62.4 KB)
html.jpeg ----> converted html image html.jpg (44.6 KB)

@SM0767,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-17097. We will further look into the details of this problem and will keep you updated on the status of this issue. We apologize for your inconvenience.

@SM0767,

Regarding WORDSNET-17097, we have completed the analysis of this issue. The problem occurs because, list markers like “a)” are not representable in CSS , because here is no corresponding “list-style-type” in CSS 2.1. You will get better results if you instruct Aspose.Words to export list items as normal paragraphs, not as <li> elements. Please tell us what are the alignment problems you are having with default ExportListLables settings? Maybe we could resolve the issue by improving export of list items to <p> elements.

We will most likely consider making list styles like “a)” representable with <li> elements by emulating such styles with “::before” pseudo-classes. Or we will wait until the CSS 3 feature “@counter-style” receives widespread support. For now, we are going to postpone this enhancement issue.

Hi Hafeez,
Thanks for your reply. Give me an info once this issue was fixed.

@SM0767,

Sure, we will keep you informed of further updates.

A post was split to a new topic: Remove spaces from generated image filename during Word to HTML conversion

A post was split to a new topic: Bullets and numbering in p tag instead of separate ol li /li /ol