Free Support Forum -

Merging Multiple Documents into 1 using client input

I posted before, but i fear i may not have explained my thoughts.

What i have is a form with multiple user inputs. Currently i use the DCom to accomplish the merging of documents

THe have documents that are numbered. There is a main ( stylized) document that is opened and then i want to insert ( add) these other documents ( or at least thier contents) to my main ( stylized) document and then save it under a new name. I am a VB developer, most code on this site is in C and i dont understand it.. Here is a reference of my code:

Dim WordApp As New Word.Application

'set the file name from the open file dialog

Dim fileName As Object = "http:/jamoss01/intranet9/trusts/data/blank.doc"

Dim readOnly2 As Object = True

Dim isVisible As Object = True

' Here is the way to handle parameters you don't care about in .NET

Dim missing As Object = System.Reflection.Missing.Value

' Make word visible, so you can see what's happening

WordApp.Visible = False

' Open the document that was chosen by the dialog

Dim aDoc As Word.Document = WordApp.Documents.Open(fileName, missing, [readOnly2], missing, missing, missing, missing, missing, missing, missing, missing, isVisible) ' Activate the document so it shows up in front aDoc.Activate();

Dim range As Word.Range = aDoc.Range(Start:=0, End:=0)

'The doc path should be relative to the web

Dim docpath As String = "http://jamoss01/intranet9/trusts/data/"

' Now we do if statements from last to first

If Section160.Checked = True Then

range.InsertFile(docpath & "section160.doc")

End If

If Section159.Checked = True Then

range.InsertFile(docpath & "section159.doc")

.......and so on until

aDoc.SaveAs("C:\inetpub\wwwroot\intranet9\trusts\output\" & outputname.Text & ".doc")

aDoc.Application.Quit(missing, missing, missing)

I want to do the same thing without DCOM

We have a new article in wiki exactly on this topic:

Please read it. It provides example written in VB.NET.

If you will have any further questions on this topic please don't hesitate to ask them here.

Best regards,

I do have some issues of not understanding.

I dont have a destination document upfront. I want to take document(s) in a file folder and merge them together based on user input to a new document.

The example provided doesnt really cover that

I have user inputs as follows


is either true or false

If true add the corresponding document to the list of documents to be merged

Then finally save a document with a filename of thier choice ( textbox.text)

I can post my code i currently use if it helps

Aspose.Words is a .NET (or Java) library. Unlike VBA you cannot use it from inside the document. Aspose.Words is basically a tool for creation, openning and manipulation of the document files from .NET Web or Windows.Forms (or Java) project. It does not provide any intaraction with MS Word, but rather permits you to manipulate word document files without having MS Word on your computer.

Try our source code demos that are included in Aspose.Words evaluation pack. They will give you the basic idea of how Aspose.Words works and what it can be used for. Also please read the introduction articles in our documentation, especially this one:

Best regards,