Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP.NET (http://www.go4expert.com/forums/asp-net/)
-   -   Merge Word Documents As Pages Of A Single Document Using VB.NET (http://www.go4expert.com/forums/merge-word-documents-pages-single-t21910/)

elizas 27Apr2010 18:22

Merge Word Documents As Pages Of A Single Document Using VB.NET
 
Lets say we have a word template file and we need to populate the template for "n" number of records and display a single large word document , instead of "n" separate documents.

So after creating the separate documents we need to merge them and create a single document with multiple pages.

Hope this tip would add some value.Any suggestions are welcomed,

mialuzzatto 15Oct2015 14:42

Re: Merge Word Documents As Pages Of A Single Document Using VB.NET
 
Hello,

Bit helpful.

alia123 17Feb2016 15:32

Re: Merge Word Documents As Pages Of A Single Document Using VB.NET
 
Hey, try this code :
Code:

  Imports RasterEdge.Imaging.Basic
    Imports RasterEdge.Imaging.Basic.Core
    Imports RasterEdge.Imaging.Basic.Codec
    Imports RasterEdge.Imaging.MSWordDocx

    Namespace RE__Test
    Public Partial Class Form1
    Inherits Form
    Public Sub New()
    InitializeComponent()
    End Sub

    Public Shared FolderName As String = "c:/"

    Private Sub button1_Click(sender As Object, e As EventArgs)
    Dim fileName1 As String = FolderName & "Sample1.docx"
    Dim fileName2 As String = FolderName & "Sample2.docx"
    Dim fileNameMerged As String = FolderName & "Merged.docx"

    Dim doc1 As REDocument = REFile.OpenDocumentFile(fileName1, New DOCXDecoder())
    'use DOCXDecoder open one word file
    Dim doc2 As REDocument = REFile.OpenDocumentFile(fileName2, New DOCXDecoder())
    'use DOCXDecoder open another word file
    Dim docMerged As BaseDocument = doc1.MergeDocument(doc2)
    'merge two word
    REFile.SaveDocumentFile(DirectCast(docMerged, REDocument), fileNameMerged, New DOCXEncoder())
    'save new word
    End Sub

    End Class
    End Namespace



All times are GMT +5.5. The time now is 13:19.