Hello,
I have an issue where if header/footer linkedToPrevious was set using headersFooters.linkToPrevious(HeaderFooterType, true), when extracting the page where linkedToPrevious is set using .extractPages(), the header/footer content is not extracted in the output document.
Code to reproduce the issue:
simple.docx has two sections, first section has header content, and second section has linked to previous set.
Document doc = new Document(new FileInputStream("/path/to/simple.docx"));
Document extr1 = doc.extractPages(1,1);
doc.getSections().get(1).getHeadersFooters().linkToPrevious(HeaderFooterType.HEADER_PRIMARY, true);
Document extr2 = doc.extractPages(1,1);
extr1.save("extr1.docx");
extr2.save("extr2.docx");
extr1.docx has a correct header content:
but extr2.docx header content is empty:
files used in example:
simple.docx (9.0 KB)
extr1.docx (9.0 KB)
extr2.docx (8.1 KB)