// doesn't seem that .docx properly supports that
// feature of the file format yet
this.doc = doc;
for(int i=0; i<sectPr.sizeOfHeaderReferenceArray(); i++) {
// Get the header
CTHdrFtrRef ref = sectPr.getHeaderReferenceArray(i);
PackagePart hdrPart = doc.getPartById(ref.getId());
HdrDocument hdrDoc = HdrDocument.Factory.parse(hdrPart.getInputStream());
CTHdrFtr hdrFtr = hdrDoc.getHdr();
XWPFHeader hdr = new XWPFHeader(doc, hdrFtr);
// Assign it
Enum type = ref.getType();
assignHeader(hdr, type);
}
for(int i=0; i<sectPr.sizeOfFooterReferenceArray(); i++) {
// Get the footer
CTHdrFtrRef ref = sectPr.getFooterReferenceArray(i);
PackagePart ftrPart = doc.getPartById(ref.getId());
XWPFFooter ftr = new XWPFFooter(doc,
FtrDocument.Factory.parse(ftrPart.getInputStream()).getFtr());
// Assign it
Enum type = ref.getType();
assignFooter(ftr, type);
}
}