I am using Aspose word for java. I have created a new Document, for which i have to set a default font family. I have set some default paragraph formats to the document as
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
doc.removeAllChildren();
builder.getParagraphFormat().setSpaceAfter(12);
builder.getParagraphFormat().setSpaceBefore(12);
Like this i have to set the default font-family as calibri and font-size as 11pt.Please guide in doing this.
But in your case it would be enough just change font of the normal style in your document.
// Open document.
Document doc = new Document("in.doc");
// Change font fon the normal style.
Style normal = doc.Styles[StyleIdentifier.Normal];
normal.Font.Name = "Arial";
normal.Font.Size = 10;
Hi,
Thanks for your reply. But I couldn’t find the method Styles for document object(doc) in my Aspose word for java API(using 4.2.0 jar). Will you provide me some sample java code for my task.
Oh, sorry, forgot to clarify. That it concerns a new version of our product 10.0. We recommend you upgrade to it. This is totally outoporting .net version. You can download it from here.
I have upgraded. But still couldn’t find the method doc.Styles. Is this API belongs to aspose words for java 10.0.
here is my code,
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
doc.removeAllChildren();
Style normal = doc.Style[StyleIdentifier.NORMAL];
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
doc.removeAllChildren();
Style normal = doc.getStyles().get(StyleIdentifier.NORMAL);
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.