We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Mail Merge

I'm no expert on this, and need some correction :-)

I'm trying to rewrite the example Employee Report Sample to talk to my sql server database and open the result as Sample.doc.
Accompany Demo.doc as I try to print to.
But get it unfortunately will not work. Help on the way would be appreciated as I suspect I have done something wrong, either in code or in demo.doc file.
Sample.doc opened, but no data, looks exactly demo.doc

--------------------------------------------------------------------------------

Dim table As New DataTable()

Dim MyConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("xxxxxx"))

Dim SelectCommand As String = "Select TOP(5) fornamn, efternamn from medlem"

Dim MyDataAdapter As New SqlDataAdapter(SelectCommand, MyConnection)

 

MyDataAdapter.Fill(table)

MyDataAdapter.Dispose()

MyConnection.Close()

dataPath = Server.MapPath("~/test/Demo.doc")

Dim document As New WordDocument()

document.Open(dataPath, FormatType.Doc)

table.TableName = "medlem"

document.MailMerge.ExecuteGroup(table)

document.Save("Sample.doc", FormatType.Doc, Response, HttpContentDisposition.Attachment)

End Sub



Attachment: Demo_c41b718a.zip

1 Reply

SK Sathish K Syncfusion Team March 12, 2014 02:59 PM UTC

Hi Kjell,

 

Thank you for your interest in Syncfusion products.

 

We have prepared a sample to show how perform mail merge with the Sql server database data. Please refer that and apply the same in your sample. If you still facing the same problem, kindly update us your sample along with the template document. Thereby we will analyse further on the mentioned problem and provide you appropriate solution.

 

Please let us know if you have any other questions.

 

Regards,

Sathish


Attachment: Sample_e00a1883.zip

Loader.
Live Chat Icon For mobile
Up arrow icon