Free Support Forum - aspose.com

'MergeImageFieldEventArgs' is not defined

I just downloaded the Aspose.Word package to test and see if we can do what we want to accomplish.

When trying to figure out how to merge an image into a document I’m getting an error “MergeImageFieldEventArgs is not defined”.

The code I’m using is:


Private Sub HandleMergeImage(ByVal sender As Object, ByVal e As MergeImageFieldEventArgs)

If e.FieldName = “PictureFileName” Then

'You can do a number of things in this event handler, this is just one scenario.

'In our case the field in the database contains a file name (without path information)

'of the image of the product category.

Dim shortFileName As String = CType(e.FieldValue, String)

'We know that the image files are stored in the same folder as the database and

'so we create the full file name.

'Here, we pass the image file name to Aspose.Word mail merge engine.

'Alternatively, we could have passed a .NET Image object or a Stream in

'e.Image or e.ImageStream properties.

e.ImageFileName = System.IO.Path.Combine(MyBase.DatabasePath, shortFileName)

End If


The rest of my regular text merges work but I’m having issues getting the merging of images working.

Any help would be appreciated so we can continue our demo of the product.

Thanks,

Josh

I also forgot to add that above the HandleMergeImage code we have the following code before the doc.MailMerge.Execute is invoked.


'Set up the event handler for image fields and perform mail merge.

AddHandler doc.MailMerge.MergeImageField, AddressOf HandleMergeImage



Thanks,

Josh

Hi Josh,

Thank you for considering Aspose.

Since the mail merge classes have been moved fron Aspose.Word to Aspose.Word.Reporting namespace, please try to add to the beginning of your code

Imports Aspose.Word.Reporting

Dmitry,

That fixed the problem. I’ll move forward from here.

Thanks,

Josh