Hi,
I have written code to create a
word document using Apache XWPF. I need to add a header and footer to this word
doc.
Following is the code:
================================================================================
When I run the above piece of code, I am getting the following runtime exception:
Caught an: java.lang.NullPointerException
Message: null
Stacktrace follows:.....
java.lang.NullPointerException
at org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy.<init>(XWPFHeaderFooterPolicy.java:106)
at org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy.<init>(XWPFHeaderFooterPolicy.java:92)
at HeaderFooterExample.createDocument(HeaderFooterExample.java:56)
at HeaderFooterExample.main(HeaderFooterExample.java:199)
=============================================================================
I am not sure what is wrong with the above code.
Any help on how to create a word document with header/footer using HWPF/XWPF will be appreciated.
Thanks..