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

Free Support Forum - aspose.com

Bulleted list not being rendered as unordered list in HTML output

I have a document (attached), and when I save it as an HTML document, the bulleted list comes out as paragraph tags, not an unordered list as expected. Any ideas?


Expected Output:

<ul>
    <li>Bullet list item 1</li>
    <li>Bullet list item 2</li>
    <li>Bullet list item 3</li>
</ul>

Actual Output:

 <p>●        Bullet list item 1</p>
 <p>●        Bullet list item 2</p>
 <p>●        Bullet list item 3</p>


Sample code (Scala, not Java):

val options = new HtmlSaveOptions(SaveFormat.HTML)
options.setImagesFolder(imageDir.getPath)
options.setImagesFolderAlias("…/folder")
options.setUseAntiAliasing(true)
options.setUseHighQualityRendering(true)
options.setScaleImageToShapeSize(false)
options.setImageSavingCallback(FilenameSanitizingSavingCallback)
options.setExportOriginalUrlForLinkedImages(true)

for {
// Load the document.
asposeDoc <- Try(new AsposeDocument(file.getAbsolutePath))

// Convert to HTML.
_ <- Try(asposeDoc.save(htmlFile.getAbsolutePath, options))
} yield FileConversionResult(htmlFile, getSeqOfImages(imageDir.getPath))
Hi Jeremy,

Thanks for your inquiry. Please use HtmlSaveOptions.ExportListLabels property as ExportListLabels.BY_HTML_TAGS to get the required output. ExportListLabels.BY_HTML_TAGS outputs all list labels as HTML native elements.

Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");

HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);

options.setExportOriginalUrlForLinkedImages(true);

doc.save(MyDir + "Out.html", options);

That worked great! Thanks for the speedy response.