F
fsharmeen
I'm trying to combine two word documents into a single file using the
InsertFile method and it seems to be working pretty well, except for
the formatting in the final document.
The individual word docs that need to be combined are styled using a
template that keeps some text on top in a single column while
formatting the rest of the doc in two columms. The problem I'm seeing
is that everthing below the first document's (DocA) header text is
getting styled in two columns - including the header of the second
document which should be in a single column.
Here's my code:
'Loop through all the files in the temp dir and copy them to one file
Dim oFinalDoc As Word.Document = oWord.Documents.Add()
Dim oFinalSelection As Selection = oWord.Selection()
For Each oFile As FileInfo In oDir.GetFiles("*.doc")
oFinalSelection.InsertFile(oFile.FullName)
oFinalSelection.InsertBreak(Word.WdBreakType.wdPageBreak)
Next
oFinalDoc.SaveAs("C:\Windows\Temp\1234\FinalDoc.doc")
Would appreciate any help in figuring out how to retain the formatting
in the final doc exactly as it is in the individual docs.
Thanks,
Fauzia
InsertFile method and it seems to be working pretty well, except for
the formatting in the final document.
The individual word docs that need to be combined are styled using a
template that keeps some text on top in a single column while
formatting the rest of the doc in two columms. The problem I'm seeing
is that everthing below the first document's (DocA) header text is
getting styled in two columns - including the header of the second
document which should be in a single column.
Here's my code:
'Loop through all the files in the temp dir and copy them to one file
Dim oFinalDoc As Word.Document = oWord.Documents.Add()
Dim oFinalSelection As Selection = oWord.Selection()
For Each oFile As FileInfo In oDir.GetFiles("*.doc")
oFinalSelection.InsertFile(oFile.FullName)
oFinalSelection.InsertBreak(Word.WdBreakType.wdPageBreak)
Next
oFinalDoc.SaveAs("C:\Windows\Temp\1234\FinalDoc.doc")
Would appreciate any help in figuring out how to retain the formatting
in the final doc exactly as it is in the individual docs.
Thanks,
Fauzia