Free Support Forum - aspose.com

Word to HTML word breaking into character with different spans

Hi Happy new year to aspose family. I am using aspose.words for .net version 15.10. While processing a word document to HTML, I came across this issue where words were broken up into spans. I have attached the test document and the problem screen. I tried to remove the style but couldn’t. Here is what I was doing:
Document doc = new document(“somedoc.docx”);
doc.AttachedTemplate = “test.dotm”; //didn’t work
foreach (Paragraph paragraph in paragraphs)
{
paragraph.ParagraphFormat.Style.Remove(); //not removing anything
paragraph.ParagraphFormat.ClearFormatting();//not removing
NodeCollection runs = paragraph.GetChildNodes(NodeType.Run, true);
paragraph.ParagraphFormat.Style.Font.ClearFormatting();
}

The problem I found (if I’m not wrong) has to do with character spacing. In the source document, a in single word for e.g. Finance, each character has different spacing style.

These are just my trial and errors, could you please replicate the issue with the document I have attached and see the output?
On a separate note, how do I apply template to a document?
Any help would be appreciated.
Thank you.

Hi Bikram,


Thanks for your inquiry. In this case, Aspose.Words mimics the behavior of MS Word 2016. I have converted this document to HTML using MS Word 2016 and attached it here for your reference.

You can use Document.AttachedTemplate property to set the full path of the template attached to the document.

Best regards,