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

Free Support Forum - aspose.com

Setting the Paragraphs font in DOCX

Hi,


I have a document file (DOCX) in which I am inserting the content of an RTF file after using
DocumentBuilder.insertDocument(rtfDoc, ImportFormatMode), I want to to set the font size of the inserted content.

I tried using DocumnetBuilder.getFont().setSize(10), but it does not work.

Please suggest which API to use to set the font size of the inserted content.

I have attached the RTF file.

Regards,
Prabhaker Kr.

Hi Prabhaker,


Thanks for your inquiry. You can set the font size of inserted rtf contents using following code example. Please check the code of FontChanger class in attachment.

Document rtf = new Document(MyDir + “in.rtf”);<o:p></o:p>

FontChanger changer = new FontChanger(11);

rtf.accept(changer);

Hi Tahir,


Thank you so much. The code works fine and the issue is resolved now.

Regards,
Prabhaker Kr
Hi Prabhaker,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.