SK
Sarath Kumar G
Syncfusion Team
July 20, 2007 05:33 PM UTC
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.htmHere is the generated document for your reference.
http://www.syncfusion.com/Support/user/uploads/Sample_a752ead1.zipYou 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
LH
Lucie Houel
July 24, 2007 07:41 AM UTC
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
SK
Sarath Kumar G
Syncfusion Team
July 24, 2007 11:20 PM UTC
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
LH
Lucie Houel
August 22, 2007 09:43 AM UTC
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
MW
Melba Winshia
Syncfusion Team
August 22, 2007 01:23 PM UTC
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=truePlease let me know if you have any other questions.
Thanks,
Melba
LH
Lucie Houel
August 22, 2007 03:18 PM UTC
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
LH
Lucie Houel
August 23, 2007 02:21 PM UTC
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
LH
Lucie Houel
August 23, 2007 02:59 PM UTC
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.
LH
Lucie Houel
August 24, 2007 07:39 AM UTC
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
MW
Melba Winshia
Syncfusion Team
August 24, 2007 02:12 PM UTC
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.htmPlease 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
LH
Lucie Houel
August 28, 2007 10:02 AM UTC
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
AD
Administrator
Syncfusion Team
August 29, 2007 07:34 AM UTC
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.zipHere 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
LH
Lucie Houel
August 29, 2007 09:30 AM UTC
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
LH
Lucie Houel
August 29, 2007 01:30 PM UTC
Hi Melba,
It works great for me now !!!!!
Thanks a lot for your help !!!!
Lucie
MW
Melba Winshia
Syncfusion Team
September 24, 2007 12:42 PM UTC
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