Free Support Forum - aspose.com

Aspose Rendering Bloat and Arbitrary Divisions

Hi guys,

We are having some trouble with Aspose Word HTML renderings of Word documents.

I’ve enclosed an example rendering in the post.

The problem is that spans in the rendering frequently break individual words or phrases into several HTML segments when it isn’t necessary. For example, the following text features near the top of the enclosed document.

(Application no. 28973/11)


Aspose renders it like this:

<span style=“font-family: Arial; font-size: 12pt; font-style: italic;”>(</span>
<span style=“font-family: Arial; font-size: 12pt; font-style: italic;”>Application no. 28973/11</span>
<span style=“font-family: Arial; font-size: 12pt; font-style: italic;”>)</span>

We would like Aspose to render this like:

<span style=“font-family: Arial; font-size: 12pt; font-style: italic;”>(Application no. 28973/11)</span>

Is this possible?

The current renderings are difficult to search by our HTML parsers and generate much larger HTML conversions than necessary.

Your help would be greatly appreciated.

Hi,


Thanks for your inquiry. Please use the Document.JoinRunsWithSameFormatting method before saving the Word document to HTML. This method joins runs with same formatting in all paragraphs of the document. Please see the code below and let us know if you have any more queries.

<span style=“font-size:10.0pt;
font-family:“Courier New”;color:#2B91AF;mso-font-kerning:0pt;mso-ansi-language:
PL;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:
“Courier New”;mso-font-kerning:0pt;mso-ansi-language:PL;mso-no-proof:yes”> doc
= new Document(MyDir

  • “in.docx”);<o:p></o:p>

doc.JoinRunsWithSameFormatting();

doc.Save(MyDir + "AsposeOut.html");