We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem while getting Font family:

Dear Team ,

I am using Aspose.words.java latest version for doc to html conversion . I am using below code to retrieve font family from the document ,the actual font family shown in Microsoft word is ’ Calibri(Body) ’ but what i am getting is ’ Times New Roman ’ .

Document doc = new Document(“fontFamily.docx”);
NodeCollection runs = doc.getChildNodes(NodeType.RUN, true, false);
for (Run run : runs) {
System.out.println(“Text font Family:”+run.getFont().getName());
Do help me .



Thanks for your request. The information about fonts you would like to get is defined in MS Word themes. When font is specified via theme MS Word shows Theme’s name in round brackets (for example “Calibri(body)”). Unfortunately, Aspose.Words does not provide an ability to get themes information. We will consider exposing themes in public API in one of future versions. Your request has been linked to the appropriate issue. We will let you know once it is resolved.

But, I think, I can suggest you a very simple workaround of this issue. Since DOC format does not support MS Word 2007 Themes, formatting specified in themes is converting to direct formatting. So as a workaround, you can save your DOCX document as DOC, then open DOC file and then get font from this document.

Hope this helps.

Hi Andrey ,
Thanks for your reply . But if i save the document as below, i get the font family as Calibri

Document doc = new Document(“fontFamily.docx”);



Thanks for your request. You will not lose any formatting upon converting document from DOCX to DOC/html. Aspose.Words preserves Themes, but you cannot get Themes properties. You will be notified as soon as it is supported.

Best refgards,

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

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