Rectangle 27 0

How to set the global font of word file via Apache poi?


XWPFStyles styles = document.createStyles();

CTFonts fonts = CTFonts.Factory.newInstance();
fonts.setEastAsia(eastAsiaFontName);
fonts.setHAnsi(normalFontName);

styles.setDefaultFonts(fonts);

I am currently stuck at how I set the default font size. That's why I found this question... The XWPFStyles class has a member "CTStyles ctStyles" with which it would be possible to define any property defined in the XML spec. But unfortunately it has only a public setter, but no getter.

You can set the default font of the document like this (using your variable names):

Note