Free Support Forum - aspose.com

Too many HTML tags - DOCX to HTML

I also have an issue with too many tags. I can’t see Andrea’s attachments, or the jira WORDSNET-14861 so I am not sure whether its the same issue.

I attach a simple docx with a single word in it. The html generated by Aspose.words for java splits the word with spans so that both parts have the same style. It would be better if these 2 pairs of tags were collapses into one.

<span style=“font-family:Calibri”>Ag</span><span style=“font-family:Calibri”>enda</span></p></div></body></html>toomanyspans.zip (9.0 KB)

@steve1elsevier,

Please try running the following code:

Document doc = new Document("D:\\toomanyspans\\toomanyspans.docx");

doc.JoinRunsWithSameFormatting();

HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.Html);
opts.PrettyFormat = true;

doc.Save("D:\\toomanyspans\\18.9.html", opts);

Hope, this helps.

@awais.hafeez
Yes that solved this problem, thanks