Aspose Doesn't get the correct Font name for docm files

Hi,

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.

Thank for your help.

Hi Jawad,

Thanks for your inquiry.

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;

I hope, this helps.

Best Regards,

Hi Jawad,

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.

Best Regards,

Thanks for your response.

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.

Hi Jawad,

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.

Best Regards,

The issues you have found earlier (filed as WORDSNET-7306) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.