Blob field Merge with Word document



I am evaluating Aspose.Word for our document generation needs. One scenario is that. I have a blob field in the database which consists of a word document. I tried to mail merge this with the same priciple of merging an image as in the sample provided. but it throws an exception as below.

Oracle table has two fields MYID and BLOBDATA where BLOBDATA is been feeded with word document. If i use an image in the blob field the merging works but, throws this exception when i have a word document in the blob field


Exception Details: System.ArgumentException: Invalid parameter used.

Source Error:

Line 80: dataReader = cmd.ExecuteReader()

Line 81: AddHandler doc.MailMerge.MergeImageField, AddressOf HandleMergeEmployeePhoto

Line 82: doc.MailMerge.ExecuteWithRegions(dataReader, “BLOBTABLE”)

Line 83: Finally

Line 84: If Not dataReader Is Nothing Then


I created the Merge document with the merge field as ?Image:BLOBDATA?

For Word blob data is the prefix something other than Image? and is there any change to be made to merging process if the blob field contains word document. Please direct me if i am doing something wrong or any sample piece of code would be greatly appreciated.




I think you should be careful and sort out what you want to merge into what because I'm not sure what you are trying to do.

From what I understand you have your Word document in a database in a BLOB field. First of all, you need to load that document into a Document object before you can use that document in any way. Check this topic for an example how to load a document from a database

If you want to use mail merge to insert one Word document into another - it does not work this way, at least not directly. I'm not sure if this is what you want to do so I'm not explaining how.