c# - Merge Multiple Word Documents while Preserving Headers - .Net Office Automation -


i want merge multiple word documents while preserving header , footer of each document. below code merging documents merges header , footer well:

public static void merge(list filestomerge, string outputfilename) {     application wordapplication = null;     document worddocument = null;      try     {         // create new microsoft word application object         wordapplication = new application();         wordapplication.visible = false;         wordapplication.screenupdating = false;          // create new file based on our template         object defaulttemplate = @"normal.dotm";         worddocument = wordapplication.documents.add(ref defaulttemplate);          // make word selection object.         selection selection = wordapplication.selection;          // loop thru each of word documents         foreach (string file in filestomerge)         {             // insert files our template             selection.insertfile(file);             object pagebreak = wdbreaktype.wdsectionbreaknextpage;             selection.insertbreak(ref pagebreak);         }          // save document it's output file.         object outputfile = outputfilename;         worddocument.saveas(ref outputfile);     }     catch (exception ex)     {         console.writeline("error while conversion. details: " + ex);     }         {         mswordcleanup(wordapplication, worddocument);     } }

is there anyway so?

it might helpful work through these training lessons: http://office.microsoft.com/en-us/word-help/headers-and-footers-from-basic-to-elaborate-rz001021662.aspx

while won't give answer in "automation form", might enough figure out answer.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -