I have a document and need to append another document to it.
I’m using this method
public void appendDocumentNode(Document dstDoc, Document srcDoc) throws Exception
{
srcDoc.getFirstSection().getPageSetup().setSectionStart(SectionStart.CONTINUOUS);
for (Object section : srcDoc)
{
if(dstDoc.getLastSection() == null)
{
Node dstSection =
dstDoc.importNode(section, true,
ImportFormatMode.USE_DESTINATION_STYLES);
dstDoc.appendChild(dstSection);<br>
}<br>
else
dstDoc.getLastSection().appendContent(section);
}
}
Two extra sections are being added between the two documents. I
need to keep the sections on each document intact because I need to
preserve the headers and footers.
Is there anyway to avoid adding the extra section breaks?
Thanks