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

Free Support Forum - aspose.com

Need to take Default FontFamily

Hi,

I have set the font family as calibri in my MSWord document. How to take such default font-family using aspose java API.

Here is the code i tried,
Document doc=new Document(“src/input/BoldItalic.docx”);
String font=doc.getStyles().get(“Normal”).getFont().getName();
System.out.println("Font-family = "+font);

But i am getting only Times New Roman instead of calibri. Provide me a solution.

Hello,

Thank you for your request.
Unfortunately I was unable to reproduce your problem.
Could you please provide your source document for analysis. And please describe your actions as you change the font for the style.

I have changed the document default font(calibri(body)) to cambria through the following steps.



Home->Change Styles->Font->Office2 Calibri Cambria. Now the
font family for my whole document is set to cambria.I want to take the
such font family(ie.,cambria)





I have tried the code like

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

String defaultFontName = doc.getDocument().getFontInfos().get(0).getName();



I am getting the right output. But is it right way to take font family.
Note: I am using Aspose.Words_4.2.0.jar.

Hi

Thanks for your request. The information about fonts you would like to get is defined in MS Word themes. 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.

At the moment all fonts used in the document are listed in fonts table (doc.getDocument().getFontInfos()). But you cannot be sure that the first font in this collection is a default font.

Best regards,

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.
(8)