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.
Unfortunately, activation email could not send to your email. Please try again.

Merge an image

Thread ID:

Created:

Updated:

Platform:

Replies:

64382 Jul 19,2007 05:15 AM Sep 24,2007 08:42 AM ASP.NET Web Forms (Classic) 15
loading
Tags: DocIO
Lucie Houel
Asked On July 19, 2007 05:15 AM

Hi,

I would like to know if is it possible to merge images ?

For example, I've got list of employees with the path to their picture and I want a word document with a table of employees : information + picture.

Thank for your help.

Lucie

Sarath Kumar G [Syncfusion]
Replied On July 20, 2007 01:33 PM


Hi Lucie,

Thank you for your interest in Syncfusion products.

Yes, it is possible to merge images and information to the document from a datasource. Here is the sample program for your reference which merges the employee information and employee image into the word document from an external datasource. Here is the sample for your reference.

http://websamples.syncfusion.com/samples/DocIO.Windows/F-64382/main.htm

Here is the generated document for your reference.

http://www.syncfusion.com/Support/user/uploads/Sample_a752ead1.zip

You can also browse through the other sample files for mailmerge from the following location, which gets installed when you install Essential Studio to your computer.

Default Location [Install Drive]: \Documents and Settings\USERNAME\My Documents\Syncfusion\EssentialStudio\Version Number\Windows\DocIO.Windows\Samples\2.0\Mailmerge\EmployeeReport

Please let me know for further help.

Regards,
Sarath

Lucie Houel
Replied On July 24, 2007 03:41 AM

Hi,

Thanks for your answer. I have to say that I use Essential Studio 4.3.0.32 with VS2003 and .NET 1.1, so I haven't got any folder [...]\Samples\2.0. However I've found a sample in my in syncfusion directory which looks like yours.

I see that the picture is saved with binary data in the database. I would like to know If it is possible to merge with the images' path ?

Thanks for your help !

Lucie

Sarath Kumar G [Syncfusion]
Replied On July 24, 2007 07:20 PM


Hi Lucie,

Thank you for your interest in Syncfusion products.

Images are written to the database only in the form of binary data. The Images are stored as binary datatypes and then stored in the database. It is not possible to store the image paths in the database. Merging Image to the document is achieved by storing it in the form of binary data. Sorry for the inconvenience caused.

Please let me know for further help.

Regards,
Sarath

Lucie Houel
Replied On August 22, 2007 05:43 AM

Hi Sarath,

I've tried to merge an image as you said. I use the SQL datatype : image.

When I open the generated document, I can the the binary data of my picture, but not the picture itself. Does it come from the SQL datatype I use ? If the answer is yes, which sql datatype must I use ?

Thanks for your help !

Lucie

Melba Winshia [Syncfusion]
Replied On August 22, 2007 09:23 AM

Hi Lucie,

Thank you for the update.

Yes. The binary data comes from the SQL datatype. Please insert your image in to database as Long Binary Data (BLOB) and let us know if the problem still exists. Kindly refer the below link to get more details regarding this issue.

http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part3/c1161.mspx?mfr=true

Please let me know if you have any other questions.

Thanks,
Melba



Lucie Houel
Replied On August 22, 2007 11:18 AM

Hi Melba,

I've already understood that I must use one of the BLOB datatypes, "image" is one of them with sql server 2000. That's why I use it. I've no problem to insert my data in my table and I make a simple select on the column.

Maybe it comes from the format of my picture, Has it to be .jpg or .gif ?

Would it possible to you to give me an example with sql server and C# or VB.Net, please ? or just pieces of code ?

Thanks a lot for your help.

Lucie


Lucie Houel
Replied On August 23, 2007 10:21 AM

Hi Melba,

I've seen something which may be interesting :

When I open your sample document : EmployeesReportDemo.doc and when I open the window to update the field "Photo", I can read this : Image:Photo in the name of the field. But If I try to do the same thing on my template, I can't read "courbe" anymore, but "Image:courbe" and the merge doesn't work at all anymore (error message).

So I've tried to do a copy paste of your field in my template and change my sql procedure to have a column named Photo, but the merge doesn't work at all anymore (error message).

So maybe the problem comes from the image field in my template ? Which property must I apply to it ?

What do you think ?

Thanks.

Lucie

Lucie Houel
Replied On August 23, 2007 10:59 AM

If I open your template with another editor, I can read :

MERGEFIELD Image:Photo \* MERGEFORMAT «Photo»

But if I try to change my template with the same editor to do that :

MERGEFIELD Image:courbe \* MERGEFORMAT «courbe»

I get an error message and I can't open my .doc file with Word anymore.


Lucie Houel
Replied On August 24, 2007 03:39 AM

Hi Melba,

I've done new tests : So I've changed my template with Microsoft Script Editor to have, like in yours, the line

MERGEFIELD Image:courbe \* MERGEFORMAT «courbe»

instead of

MERGEFIELD courbe \* MERGEFORMAT «courbe»

I can open the update file with word and if I open the field window I can see, like in yours, Image:courbe in the name.

I try to do the merging with it and I get an error : 'System.ArgumentNullException' occured in syncfusion.dls.base.dll. The value can't be null. I've check : all my columns have values. If I try with the old file with the line : MERGEFIELD courbe \* MERGEFORMAT «courbe». I've no error, but I see the binary code instead of the picture.

Any idea ?

Thanks.

Lucie


Melba Winshia [Syncfusion]
Replied On August 24, 2007 10:12 AM

Hi Lucie,

Thank you for the update.

I am afraid that I was not able to reproduce the issue. Please refer to the following steps that I tried to reproduce it.

1. Created a table "Images" which contains a field "stream" with image datatype in SQL server. Please refer the code snippets that I used to insert image to database in the below text file.

http://www.syncfusion.com/Support/user/uploads/CodeToInsetImagesToSQL_d8f84ae1.zip


2. Run the mail merge sample

3. The images are inserted correctly.

Also I have created a simple sample to test this issue and it is available in the following link.

http://websamples.syncfusion.com/samples/DocIO.Windows/64382/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps so that we could sort out the cause of the issue and provide you a solution?

Thanks,
Melba

Lucie Houel
Replied On August 28, 2007 06:02 AM

Hi Melba,

I try to do as you said :

Create the Images table

Moreover I've tried to use the sample of employees to do the merge and I've got an error. So I give you :

- my test project files
- the sql file of my table Images creation
- a screenshot of the error

Hope you'll be able to help me.

Thanks for your help.

Lucie

site_test.zip

Administrator [Syncfusion]
Replied On August 29, 2007 03:34 AM

Hi Lucie,

Thank you for the update.

On analyzing your sample we found that the table name created in database was Images and the field name was streams. But in the template document the table name and field name was not changed and it is as Employees and Photo. So after creating a new table with table name "Employees" and Field name "Photo" the application worked fine. Please refer the modified sample in the below link which illustrates the above.

http://www.syncfusion.com/Support/user/uploads/site_test_519a6a16.zip

Here is the video clip for your reference:

http://www.syncfusion.com/Support/user/uploads/video_32d68fa5.zip


Kindly let me know if you have any other questions.

Thanks,
Melba




Lucie Houel
Replied On August 29, 2007 05:30 AM

Hi Melba,

In my sample code, you can see that :

1) Before the merging, I rename the datatable with "Employees".

2) In the sql statement I make an alias of my field : "select stream AS Photo ..".

So I don't think my problem is here, but I'll check what you give to me to try anyway.

Lucie

Lucie Houel
Replied On August 29, 2007 09:30 AM

Hi Melba,

It works great for me now !!!!!

Thanks a lot for your help !!!!

Lucie

Melba Winshia [Syncfusion]
Replied On September 24, 2007 08:42 AM

Hi Lucie,

Thank you for the update.

Glad to hear that it works fine.

Please let me know if you have any other questions.

Thanks,
Melba

CONFIRMATION

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.

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.

;