Hi Team,
I am inserting documents(aspose word doc) dynamically to one main document(aspose word doc) using
DocumentBuilder.insertDocument() method. I have also dynamic configuration for document orientation in my DB which I can set as Landscape or Portrait. Earlier when there was no landscape orientation, I was able to insert Header in the document, but as I change orientation to Landscape, header goes from several pages and on last few pages header appears.
I have also created Header.docx file in which I have created header and inserting Header.doc file into main document after collating all word documents.
Inserting headerDoc using below code
builder.insertDocument(headerDoc, ImportFormatMode.USE_DESTINATION_STYLES);
Code to change page orientation and inserting doc
if (section.isLandscape()) {
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.getPageSetup().setOrientation(Orientation.LANDSCAPE);
builder.insertDocument(srcDocument,ImportFormatMode.USE_DESTINATION_STYLES);
builder.insertBreak(BreakType.SECTION_BREAK_NEW_PAGE);
builder.getPageSetup().setOrientation(Orientation.PORTRAIT);
} else {
builder.insertDocument(srcDocument,ImportFormatMode.USE_DESTINATION_STYLES);
}
Please help, how to set header and footer when we change page orientation.