Aspose.Words.Document.Save improperly adding span around certain characters

In this method: Aspose.Words.Document.Save

In the generated html, when there is an underscore (_) or a combination of ':' and '{' (e.g, ": { <%a%>"), the characters after it is broken up and placed in a new span, at that point. So, while visually the HTML looks fine in a browser, the markup itself is chopped up into spans inappropriately and makes parsing harder. For example, this: <%test_fb%> becomes:

This is a test:

Rather than
This is a test:

To repro this:

1. Create a docx file with this content:

This is a test: <%testing_fb%>

No the dew: { <%Break-Fix Required Text value%>} It should have a default value.

No the dew: { <%TesterraGuid%>} It should have a default value.

2. Pass the docx file through: Aspose.Words.Document.Save

3. The HTML looks fine in a browser, but reading the markup, their is inappropriate span-additions that would make parsing harder or hacky.

Hi Phil,

Thanks for your inquiry. Please call Document.JoinRunsWithSameFormatting() method before saving to HTML. I hope, this helps.

PS: Please make sure that you’re using latest version i.e. Aspose.Words 15.6.0

Best regards,