Free Support Forum - aspose.cloud

DOCX to HTML conversion with CssStyleSheetType:Inline still produces an embedded stylesheet

Hi,

Converting a docx with nested ordered list still results to an inconsistent HTML with embedded stylesheet even if CssStyleSheetType:Inline has been outright defined.

    HtmlSaveOptionsData({
		saveFormat: 'html',
		fileName: destName, 
		**cssStyleSheetType: 'Inline'**,
		exportImagesAsBase64: true,
		exportFontsAsBase64: true,
		imageResolution: 300
	})

Setting ExportListLabels:AsInlineText is out of the question since we specifically want the resulting unordered list labels as HTML tags.

Ideally, the desired HTML result does not contain any embedded stylesheet and all list labels as HTML tags.

The problematic point producing the embedded stylesheet in the attached docx is 2.1 Sub-Item 2.1 It differs from 1.1 Sub-Item 1.1 which HTML format is the desired result (p and span tags).

testdoc.zip (13.7 KB)

@bulletsoul

After initial investigation, we have logged a ticket WORDSCLOUD-1307 for further investigation and to fix the ordered list CSS. We will keep you updated about the issue resolution progress within this forum thread.

Hi! Do we have any updates if the ordered list CSS is going to be fixed? Thanks!

@bulletsoul

I’m afraid the issue is still not resolved. We will notify you as soon as we have any updates.

@bulletsoul
Thanks for your patience. We have investigated your above reported issue.
Please note in reference to inconsistent ordered list CSS, by default, Aspose.Words tries to export lists as HTML lists ( <ol / <ul> ) where possible and falls back to exporting lists as HTML paragraphs ( <p> ) in complex cases. MS Word, however, always exports list items as HTML paragraphs. Users can change behavior of list export in Aspose.Words by using the HtmlSaveOptions.ExportListLabels property.

So it this is not a bug. you should save the document with the HtmlSaveOptions.ExportListLabels=ExportListLabels.AsInlineText option if you want all list items to be exported as HTML paragraphs like in MS Word-generated documents.