Click here to Skip to main content
15,918,168 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
here in the below coding a paragraph is added to new document created with vb.net coding, but i need to merge a document file in the newly created document, kindly guide me the coding...........


VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

      Dim oMissing As Object = System.Reflection.Missing.Value
      Dim oEndOfDoc As Object = "\endofdoc"
      ' \endofdoc is a predefined bookmark

      'Start Word and create a new document.
      Dim oWord As Word._Application
      Dim oDoc As Word._Document
      oWord = New Word.Application()
      oWord.Visible = True
      oDoc = oWord.Documents.Add(oMissing, oMissing, oMissing, oMissing)

      'Insert a paragraph at the beginning of the document.
      Dim oPara1 As Word.Paragraph
      oPara1 = oDoc.Content.Paragraphs.Add(oMissing)
      oPara1.Range.Text = "Heading 1"
      oPara1.Range.Font.Bold = 1
      oPara1.Format.SpaceAfter = 24
      '24 pt spacing after paragraph.
      oPara1.Range.InsertParagraphAfter()
Posted
Updated 11-Nov-11 18:51pm
v2

Check out the following link.
It will help yo ufor how to Split or Combine two files using Vb.Net
How to Split or Merge Two Files
 
Share this answer
 
here[^] is nice example of word merge.

check this[^] also.
 
Share this answer
 
Instead of using Word Automation, check on OpenXML Developer[^] how to do it with OpenXML SDK.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900