Hi There,
can’t seem to get this to work (most likely, because I don’t understand the MergeImageField Event Handler yet).
I have created an image handler for a web app that lets me extract images easily from a db with only one line of code. I would like to use this for a MailMerge to enter images in a word document. In essence my question is how to do an image MailMerge via URLs.
sample code :
Sub show_doc(ByVal ID As String)
Dim MyPath As String = HttpContext.Current.Request.PhysicalApplicationPath & "_sampledir/document.doc"
Dim doc As Document = New Document(MyPath)
Dim img1 As String = "ImgHandler.aspx?ID=" & ID
Dim img2 As String = "ImgHandler.aspx?ID=" & ID
' set field Names
Dim names As String() = {"Pic1", "Pic2"}
' Set field Values
Dim values As Object() = {img1, img2}
' MailMergeEventHandler
AddHandler doc.MailMerge.MergeImageField, AddressOf HandleMergeImage
doc.MailMerge.Execute(names, values)
' Send the Doc to the Client
doc.Save("FaxForm.doc", SaveFormat.Doc, SaveType.OpenInBrowser, HttpContext.Current.Response)
End Sub
Private Shared Sub HandleMergeImage(ByVal sender As Object, ByVal e As Aspose.Words.Reporting.MergeImageFieldEventArgs)
' what goes here ????
End Sub
Thx in advance!
Marcus.