Free Support Forum - aspose.com

Associate CSS classes to Word Style

Hello,
I’m trying to convert a docx to HTML then back to docx but I must do something wrong because the styles aren’t associated back.
you can find my test project here ConsoleApp2.zip (65.0 KB)

thanks for the help

@brbardin,

The following C# code of Aspose.Words for .NET API returns 76 style count for “doc.docx” and “template.docx” documents and 16 styles count for “doc_exported.docx”. Is this the problem you are talking about?

Document doc = new Document("C:\\Temp\\ConsoleApp2\\ConsoleApp2\\template.docx");
Console.WriteLine(doc.Styles.Count);

We have noticed that the “doc_exported.docx” was generated by using an old 18.5 version of Aspose.Words for .NET; we suggest you to please upgrade to the latest 20.11 version of Aspose.Words for .NET and see how it goes on your end? In case the problem still remains, then please also create a comparison screenshot which highlights the problematic areas in Aspose.Words 20.11 generated DOCX (with respect to original document) and attach it here for our reference. We will then investigate the issue further on our end and provide you more information.