I have just started using POI and I am trying to set the font family for a
XWPFRun using XWPFRun#setFontFamily() but it always crashes with a
NullPointerException. I have tried this with POI versions 3.7 and 3.8 Beta 4
with the same results.
The font exists and the run's text is not null so why would this fail? I
cannot locate the source in question but the actual exception is:
java.lang.NullPointerException
at
org.apache.poi.xwpf.usermodel.XWPFRun.setFontFamily(XWPFRun.java:465)
Does anyone know how I can get around this? Calling XWPFRun#getFontFamily()
immediately before trying to set it returns null but I wouldn't have thought
that would matter.
Thanks,
-jct