c# - Adding Complex Header From One Word Doc to Another -
i using addheaderfromto
function https://msdn.microsoft.com/en-us/library/office/cc546917.aspx. issue it's not taking images or tables might found in header section of document. there way header other document?
the vba script below should you. run word document. modify suit.
sub editall() dim doc dim integer dim doctoopen filedialog set doctoopen = application.filedialog(msofiledialogfilepicker) doctoopen.show = 1 doctoopen.selecteditems.count 'open each document set doc = documents.open(filename:=doctoopen.selecteditems(i)) activedocument.sections(1) 'insert new headers call editheader end next end sub sub editheader() if activewindow.view.splitspecial <> wdpanenone activewindow.panes(2).close end if if activewindow.activepane.view.type = wdnormalview or activewindow. _ activepane.view.type = wdoutlineview activewindow.activepane.view.type = wdprintview end if activewindow.activepane.view.seekview = wdseekcurrentpageheader selection.pagesetup .linenumbering.active = false .orientation = wdorientportrait .topmargin = inchestopoints(1) .bottommargin = inchestopoints(1) .leftmargin = inchestopoints(1) .rightmargin = inchestopoints(1) .gutter = inchestopoints(0) .headerdistance = inchestopoints(0.1) .footerdistance = inchestopoints(0.5) .pagewidth = inchestopoints(8.5) .pageheight = inchestopoints(11) .firstpagetray = wdprinterdefaultbin .otherpagestray = wdprinterdefaultbin .sectionstart = wdsectionnewpage .oddandevenpagesheaderfooter = false .differentfirstpageheaderfooter = false .verticalalignment = wdalignverticaltop .suppressendnotes = false .mirrormargins = false .twopagesonone = false .bookfoldprinting = false .bookfoldrevprinting = false .bookfoldprintingsheets = 1 .gutterpos = wdgutterposleft end selection.headerfooter.linktoprevious = not selection.headerfooter. _ linktoprevious selection.headerfooter.linktoprevious = not selection.headerfooter. _ linktoprevious selection.inlineshapes.addpicture filename:= _ "c:\users\rshuell001\desktop\test\asher.jpg", linktofile:=false, _ savewithdocument:=true activewindow.activepane.view.seekview = wdseekmaindocument end sub