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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ImageMerge problem

Thread ID:





74221 Jun 3,2008 10:20 PM UTC Jun 4,2008 04:48 AM UTC WinForms 1
Tags: DocIO
Administrator [Syncfusion]
Asked On June 3, 2008 10:20 PM UTC

I am in trouble with mail merging images. There is no problem with images form database. But when I am using the code below the mailmerge causes an "ArgumentException" exception.

DataTable dt2 = new DataTable(); dt2.Columns.Add("Photo1",typeof(System.Byte[]));
dt2.TableName = "Photos";
DataRow dr2;
dr2 = dt2.NewRow();
FileStream fs = new FileStream("1.gif",FileMode.Open);
BinaryReader br = new BinaryReader(fs);
dr2["Photo1"] = br.ReadBytes((int)br.BaseStream.Length));
dr2["Photo2"] = br.ReadBytes((int)br.BaseStream.Length));
br = null;
fs = null;


The i have configured merge fields in word document like in your emloyeesreport example.
where is the problem ? cany ou give me an advice about merging an external image form hdd to the merge field (Image:Photo1) of word document template.

Thank you

Bhuvaneswari P [Syncfusion]
Replied On June 4, 2008 04:48 AM UTC

Hi Lokelse,

Thank you for your interest in SYncfusion products.

I am able to reproduce the issue. This is due to the image is not converted to bytes properly. Please refer the below code snippet to do so:


FileStream fs = new FileStream(@"..\..\Nature.jpg",FileMode.Open);
byte[] inByte = new byte[fs.Length];
fs.Read(inByte, 0, inByte.Length);
dr2["Photo1"] = inByte;
dr2["Photo2"] = inByte;

Here is the sample for your reference:


Please try this and let us know if this helps you.

Best Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon