Bullets and numbering in <p> tag instead of separate <ol> <li> </li> </ol>

Hi, can I put all the bullets and numbering in <p> tag instead of separate <ol><li></li></ol>?

@anishhard,

Please try using the following code:

Document doc = new Document("E:\\temp\\in.docx");

HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.Html);
opts.PrettyFormat = true;
opts.ExportListLabels = ExportListLabels.AsInlineText;
            
doc.Save("E:\\Temp\\19.5.html", opts); 

Hope, this helps.

1 Like

@awais.hafeez Thanks, it works :slight_smile:

@awais.hafeez Just one help, what is the conversion pattern that aspose follows for converting docx to html ? I’m getting a pattern of conversion like<div><p></p></div>. Is this the correct pattern ?? Is there any documentation for docx to html conversion ?? If you can provide, it will be helpful.

Note : I’m creating a logic to pick data according to the aspose html pattern.

@anishhard,

Generally, sections are exported as <div> elements, paragraphs as <p>, tables as <table>, etc. So, the overall structure of HTML documents is indeed <div><p></p></div>. I am afraid, we do not have a document describing this structure, however, because we consider it internal implementation details and may change it without notice. We would not recommend to develop applications that depend on specific structure of HTML documents produced by Aspose.Words. However, we do not do frequent structural changes but you need to take care of your logic when you wish to update to newer Aspose.Words versions.

1 Like

This is quiet helpful for understanding. Thanks :slight_smile:

I need a help ! I’m trying to get the part of html according to text comparison. Is there any API in Aspose to get a part of html based on text. Can you provide the code ?

Note : It should be an exact match

@anishhard,

You can Extract Selected Content Between Nodes in a Document and then save the generated Document to HTML format. Please also refer to the following article:
https://docs.aspose.com/words/net/find-and-replace/

Can you provide a code example ?

@anishhard,

You can get the code example from the article link that I shared earlier. Please also check following example project:
https://github.com/aspose-words/Aspose.Words-for-.NET

Hope, this helps.