VB.NET Code to Join Append or Merge Word DOCX RTF ODT Documents into One using Aspose.Words for .NET

hi. i try to Join a Document onto another Document

but i get the next error

BC30451: ‘RunExamples’ is not declared. It may be inaccessible due to its protection level.

here part of code and the files

   Dim dataDir As String = RunExamples.GetDataDir_JoiningAndAppending()
    if fileUrl1 <> "" then 
      Dim dstDoc  As New Aspose.Words.Document(fileUrl1)
      Dim srcDoc As New Aspose.Words.Document(fileUrl0)
    
    
      srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.NewPage
      dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting)
      dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);
      srcDoc.Save(dataDir)
      response.write(dataDir)
      response.end
      
    
    End If

file1.zip (62.6 KB)

@eranlipi,

The following VB.NET code example of “Aspose.Words for .NET” API should merge these two Word DOCX documents into one.

Imports Aspose.Words

Module Module1

    Sub Main()

        Dim lic As New License()
        lic.SetLicense("C:\Temp\Aspose.Words.lic")

        Dim dstDoc As New Document("C:\Temp\file1\file1.docx")
        Dim srcDoc As New Document("C:\Temp\file1\file2.docx")

        srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.NewPage
        dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting)

        dstDoc.Save("C:\Temp\file1\output.docx")

    End Sub

End Module

For more details, please refer to: Join and Append Word Documents

1 Like