none
MailMerge RRS feed

  • Question

  • Below is a posting I made a little while ago that got no responses.

    I have since downloaded the OpenXMLSDK 2.0 and am trying to work my way
    through some ideas.

    I have found the MailMerge class in the
    DocumentFormat.OpenXml.Wordprocessing Namespace but Im finding it impossible
    to find any examples of how I might use this class on an existing word
    mailmerge template document.

    In pseudo code Im trying to do something like this

      Using doc

                Dim oMM As New MailMerge (doc)

                oMM.DataSource = MyExcelWorksheetContainingMyData
                oMM.Destination = NewWordDocument
                oMM.MergeData

        End Using

    If anyone could provide some examples of how to accomplish this task.  If I dont find out how to do this soon then I will need to find a non.msoffice solution to the problem

    tia

    Terry Holland

    Original Posting
    ==============================================
    I  am re-writing a vb6 application that uses automation to mail-merge into
    MS
    Word templates (there are approx 200 legacy 2002 templates)

    The new version of the app is going to be an asp.net application running on
    the company intranet.

    I am aware that having word installed on the web/app server is not an option
    recommended or supported by MS, so I am looking for alternative solutions
    that will
    enable me to utilise the existing word templates.

    Could someone advise me on the feasability of having my server based code
    creating xml docs that could be used as the datasource for a word mailmerge
    template.  I have heard a little of MSOpenXML for office 2007 documents and
    am wondering if it would be possible to build an word doc using this
    technology, without the need for Office to be installed on server.

    I invite a discussion around this topic in the hope that I will pick the
    best solution after taking into account he following considerations
    1) all users will have MS Word installed on their PC (currently 2003)
    2) we want ot be able to utilise the exising 200 MS Word mail-merge
    templates
    3) user want to be able to create new mail-merge templates within a familiar
    envoronment ie MS Word


    Monday, February 9, 2009 10:29 AM

All replies

  • Terry

    I'm starting to work on the same problem Have you found a example?

    George
    Wednesday, February 24, 2010 2:13 AM
  • Hi terry holland,

    Thanks for your question.

    As for your question, could you please give us more detailed description about your scenario? What do you want to do with MailMerge? Maybe we could find out another solution using SDK instead of MailMerge in VB to resolve your problem (e.g. create a template and populate it with data).

    Thanks,

    Lu
    Thursday, March 4, 2010 2:41 AM
  • I too am trying to implement a similar solution. What I would like to do with MailMerge is allow the end user build the document with merge field selections from within Word and text that they type (for example, Dear Mr/Mrs <Last Name Field>) where the <Last Name Field> is chosen from and selection of available merge fields from within Word. These available merge fields would be populated from and SQL Server view in a database. The template could be saved to the data base and in the application can choose which template to use and the merge fields populate with data based on current record the end user is working with in the application at that time. Is this possible in OpenXML SDK today? Thanks.
    Sunday, April 4, 2010 11:29 PM
  • Anyone used spire.Doc ? I feel it other easy way to merge mail temolates . maybe best c# word component to .net. too powerful !!
    Tuesday, August 10, 2010 6:14 AM