I\'m having serious trouble adding a new, simple XWPFTable to an XWPFHeader (or Footer). Unfortunately there seems to be only one guy having the same problem (https://bz.apache.
Create table in docx document footer with Apache POI:
XWPFHeaderFooterPolicy policy = document.getHeaderFooterPolicy();
if (policy == null)
policy = document.createHeaderFooterPolicy();
XWPFHeaderFooter footer = policy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
XWPFParagraph p = footer.createParagraph();
p.createRun().setText("My First Footer");
XWPFTable t = footer.createTable(1, 3);
XWPFTableRow r = t.getRow(0);
r.createCell().setText("Uno");
r.createCell().setText("Dos");
r.createCell().setText("Tres");