1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Namespace Sample
Friend Class Merge
Shared Sub Main(ByVal args() AsString)
'Load Document
Dim document AsNew Document()
document.LoadFromFile("D:\Documents\Introduction.docx", FileFormat.Docx)
Dim document2 AsNew Document()
document2.LoadFromFile("D:\Documents\History.docx", FileFormat.Docx)
'Merge
For Each sec As Section In document2.Sections
document.Sections.Add(sec.Clone())
Next sec
'Save and Launch
document.SaveToFile("Merge.docx", FileFormat.Docx)
System.Diagnostics.Process.Start("Merge.docx")
End Sub
End Class
End Namespace
End Sub |
Partager