We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Replacement of BarcodeImage on DocVariable Field

Right now I have a parameter and value. So based on value i am creating the barcode Image as a memorystream. So How can i replace my image on text.

Please suggest me the way.

This is field which i generated in my document.

{DOCVARIABLE ApttusBarcode 12345678 \* MERGEFORMAT}



Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I think that it is better to use mergefield or bookmark instead docvariable in this case.

In case of using mergefilds you can use MergeImageField event handler to insert barcode image. See the following link for more information.


In case of using bookmarks you can use DocumentBuilder.MoveToBookmark and InsertImage methods to insert Barcode image at the bookmark.

Also could you please attach your document for investigating?

Best regards.


Thanks for the information.

Attached is my document and docvariable class.

Because we have already used fields in our document.

I have also created internal class which you have for Hyperlink..

For mailmerge i tried. But i am not able to pass my image directly with execute method. I have also created datatable and tried to pass it. But no success. Its asking for Imailmergedatasource.

Please suggest me.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for additional information. You can use mergefields with “Image:myImage” name. For example see attached template and the following code:

//Read image to byte array

byte[] img = File.ReadAllBytes(@"Test049\test.jpg");

string[] names = { "myImage" };

object[] values = { img };

//Opn template

Document doc = new Document(@"Test049\in.doc");

//Execute mail merge

doc.MailMerge.Execute(names, values);

//Save document


Best regards.

Its works..