In word docm file, when we change the font of the Normal style to something else (to Arial in my app) and we try to get its font with Aspose.Words 11.7.0, we always get Time New Roman font name (instead of Arial).
I have attached a sample app demonstrating our issue.
Note that problem exist also in all version of Aspose.Words.
The problem occurs because you specified a font via theme, MS WORD shows theme name in round brackets e.g. Arial (Body CS); Aspose.Words preserves Themes, during saving to DOCX format. I think, I can suggest you a very simple workaround of this issue. Since DOC format does not support MS Word 2007/2010 Themes, formatting specified in themes will be converted to direct formatting upon saving DOCX to DOC format. So as a workaround, you can save your DOCX document as DOC, then open DOC file and then get font from this document as follows:
Document docm = new Document(@"C:\Temp\Doc1.docm");
MemoryStream docStream = new MemoryStream();
docm.Save(docStream, SaveFormat.Doc);
Document doc = new Document(docStream);
string str = doc.Styles[StyleIdentifier.Normal].Font.Name;
Moreover, I have logged this issue in our bug tracking system. The issue ID is WORDSNET-7306. Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.
Unfortunately, we need to process a big amount of word document and the implementation you have suggested is not an option for us (converting docm to doc would cause a huge performance lack).
If you have any other work around, it would be appreciated.
Thanks for your inquiry. That’s understandable; I am afraid, you’ll have to wait for the fix of this issue to come out in one of the future versions of Aspose.Words. We will inform you as soon as this issue is resolved. We apologise for any inconvenience.