Free Support Forum -

Word document merging issue

I have two word templates in that one is containing fixed text and the other one is used for mailmerge contents. I have to merge these two documents together and display as one document. I have used the below code to implement this.

public void CreateWordDoc()




DataTable dtInfo = method to get data from db;

Document oDocApplns = new Document(@"C:\Temp\template2.doc");


Document oDoc = new Document(@"C:\Temp\template1.doc");

foreach(Aspose.Words.Section oSecAppln in oDocApplns.Sections)


Aspose.Words.Section oSrcSec = (Aspose.Words.Section) oDoc.ImportNode(oSecAppln,true);


//I have tried the below method also but it is not giving me the expected format.

// oDoc.Sections[oDoc.Sections.Count - 1].AppendContent(oSrcSec);


oDoc.ProtectionType = ProtectionType.ReadOnly;

oDoc.Save("MyTest.doc", SaveFormat.FormatDocument, SaveType.OpenInBrowser, Response);


catch(Exception oEx)





The problem I am having here is,

The first template document is having roman letters and second template is having numeric page numbers like Page 1 of 3. I found that after mail merging , if 20 pages are there in the second document it's repeating the page numbers i.e. Page 1 of 3, Page 2 of 3, Page 3 of 3 followed by Page 1 of 3,Page 2 of 3...,,. Please provide a solution for this asap.



Please provide both template documents and the second document after mailmerge. I’ll check what could be done.