How to Merge two Microsoft Word documents with Even/Odd Header Footers using Aspose.Words API

I am generating a merged document on the basis of two documents using Aspose.Words Document class.

Source Document is having multiple pages with Even and Odd Header footers and another document is empty with no header/footer.

My requirement is to merge source document with the blank document with even and odd header in the proper place in the final document but somehow merged document is having only odd header and footers.
Below is the source code and documents. Please have a look and suggest changes in order to achieve the required functionality.

string originalDocumentPath = @“D:\originaldocument.docx”;
string blankDocumentPath= @“D:\blankdocument.docx”;
string mergedDocumentPath = @“D:\mergeddocument.docx”;

        Aspose.Words.Document originalDoc = new Aspose.Words.Document(originalDocumentPath);
        Aspose.Words.Document mergedDoc = new Aspose.Words.Document(blankDocumentPath);

        mergedDoc.AppendDocument(originalDoc, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
        mergedDoc.Save(mergedDocumentPath, Aspose.Words.SaveFormat.Docx);

Here are 3 documents within zip file.
documents.zip (46.7 KB)

@mehtabcompunnel

This forum is for topics related to Aspose REST APIs whereas your query is relevant to Aspose Native/Downloadable APIs. Please follow this thread Merge two documents with Even/Odd Header Footers - Free Support Forum - aspose.com for an answer to your query.

Thanks @sohail.aspose for your quick response and showing me righteous path. :love_you_gesture:

1 Like