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. Image for the cookie policy date
close icon

Word Template with Images

Hi there,

I have a word template with embedded static images. I''ve read in the previous posts that you cannot replace string tags with dynamic images...

Is DocIO capable of rendering static images to the output? Basically right now, I can generate a word document with the correct text but all the images are gone.

John

9 Replies

AD Administrator Syncfusion Team August 29, 2006 06:19 PM UTC

Hi John,

Thank you for your interest in Essential DocIO.

1. Yes, you are correct. The current version of DocIO does not support to replace a placeholder by image. Currently, we are working with this feature and we will try to get this implemented as soon as possible.

2. Also, DocIO have a capable of rendering images to the document and preserving the images from the template documents. I have created a small samples to illustrate these functionalities. Could you please take a look at the attached sample and let me know if it meets your need.

3. But the layout formatted images from template are not preserved by DocIO. I have already noticed the issue and I have filed a bug report regarding this issue with our development team. You can track the live status of this issue here,

 Defect #1701 - Formatting Pictures with Layout can not preserved by DocIO.


Thanks,
Prabhu.


Samples3.zip


AD Administrator Syncfusion Team August 29, 2006 07:02 PM UTC

Hello Prabhu,

Thanks for the quick reply. I d/l''ed and tested the preserving_images project and it works. I was trying to integrate it into my own and it doesnt seem to work.

I am creating a web app that reads in a word template with images, finds and replaces some text, and renders the output as an attachment. Here is my code...

// Create document.
WordDocument document = new WordDocument();

// Open template document.
document.Open ( Server.MapPath ( Path.Combine ( @"Templates\" , "test.doc" ) ) , FormatType.Doc );

//Find and Replace.
document.Replace( "" , "My Company" , true , true );

//Save
document.Save( "Sample.doc" , FormatType.Doc , Response , HttpContentDisposition.Attachment);

Is there a specific flag or method that I need to call inorder to preserve the images?

John


AD Administrator Syncfusion Team August 29, 2006 07:19 PM UTC

UPDATE:

It seems that the code works...I think the images in the template are of another format and not being picked up...


AD Administrator Syncfusion Team August 29, 2006 07:23 PM UTC

Hi John,

Thanks for the update. Could you please track the samples under…

C:\Program Files\Syncfusion\Essential Studio\4.2.0.37\Web\docio.web\Samples\1.1\Find And Replace

Hope these samples will help you to go forward with your application project. Please let me know if you need any other assist?

Thanks,
Prabhu.


>UPDATE:

It seems that the code works...I think the images in the template are of another format and not being picked up...


AD Administrator Syncfusion Team August 29, 2006 07:49 PM UTC

Hi Prabhu,

I have found the root cause of the problem. 2 things actually...

1) the images were links to another file. So I embedded them into the word doc and tested it...didnt work.

2) it turns out that the images were laid out as "In front of text" wrapping style. I changed it to "In line with text" and it messed up the layout, but the images are being preserved.

so this pretty much brings us back to the bug you mentioned...#1701

I do have a question tho, is it possible to preserve linked images?

John


AD Administrator Syncfusion Team August 29, 2006 08:51 PM UTC

I feel like a posting whore here with all these questions

I have yet another question...

I am trying to read in a 45 page word template and my app is hanging on the following line of code:

document.Open ( Server.MapPath ( Path.Combine ( @"Templates\" , "EnglishMaster.doc" ) ) , FormatType.Doc );

is this an evaluation copy limitation?

John


AD Administrator Syncfusion Team August 29, 2006 10:12 PM UTC

Hi John,

I was able to see the problem when the image is set links to another file, folder or web page. I have filed a bug report regarding this issue with our development team. You can track the live status of this issue here,
Defect #2621 - Image is missing, when it set as a Hyperlink.

We appreciate you to bringing this issue to our attention.

Thanks,
Prabhu.


>Hi Prabhu,

I have found the root cause of the problem. 2 things actually...

1) the images were links to another file. So I embedded them into the word doc and tested it...didnt work.

2) it turns out that the images were laid out as "In front of text" wrapping style. I changed it to "In line with text" and it messed up the layout, but the images are being preserved.

so this pretty much brings us back to the bug you mentioned...#1701

I do have a question tho, is it possible to preserve linked images?

John


AD Administrator Syncfusion Team August 29, 2006 10:22 PM UTC

Hi John,

There is no evaluation copy limitation for opening an existing template documents and processing it. We have an ability to read more number of pages from the template document. I am not sure about the problem happens in your template document.

Could you please create a Direct – Trac incident and send us your copy of template document [It should be more confidential]. So that we able to find the issue from the template document.

Thanks,
Prabhu.


>I feel like a posting whore here with all these questions

I have yet another question...

I am trying to read in a 45 page word template and my app is hanging on the following line of code:

document.Open ( Server.MapPath ( Path.Combine ( @"Templates\" , "EnglishMaster.doc" ) ) , FormatType.Doc );

is this an evaluation copy limitation?

John


AD Administrator Syncfusion Team October 17, 2006 10:40 AM UTC

Hi John,

Sorry for delay in getting back to you.

We are glad to inform that the issue [#2621] regarding missing images, when it set as hyperlink has been fixed in our latest internal source and this fix will be available in our next release of Essential Studio (v.4.4). Please let me know if you have any questions.

Thank you for your patience.

Best regards,
Prabhu


>Hi John,

I was able to see the problem when the image is set links to another file, folder or web page. I have filed a bug report regarding this issue with our development team. You can track the live status of this issue here,
Defect #2621 - Image is missing, when it set as a Hyperlink.

We appreciate you to bringing this issue to our attention.

Thanks,
Prabhu.


Loader.
Live Chat Icon For mobile
Up arrow icon