I'm a newbie of apache poi, and am using poi to write some data to docx file. Recently I encountered a problem of font, hope any body can give me some help.
I began the writing with an empty word file named empty.docx, as following.
InputStream input = getClass().getClassLoader().getResourceAsStream("empty.docx");
XWPFDocument document = new XWPFDocument(input);
In the empty.docx the default font is 'Arial', that means if you add any content they will inherit this font as long as you don't change the font manually.
But after I filled the content and write it to a new docx file,the default font was changed to 'Century'.
OutputStream output = new FileOutputStream("output.docx");
document.write(output);
I want to change it back to 'Arial', but after a lot of search only found the methods to set font of XWPFRun.
run.getCTR().getRPr().getRFonts().setEastAsia(eastAsiaFontName);
run.getCTR().getRPr().getRFonts().setHAnsi(normalFontName);
I want to know if there is any method to change the global font of the whole document?