Hi.
I fill a word template with merge fields. Some merge fields are filled with html code, but those merge fields instead of showing the raw html code, are showing the rendered html in the word document because i’m using the IFieldMergingCallbak in order to render the html code. This is working fine, but the images are not being displayed, instead of the image there are a big red cross.
For instance, I fill the merge field this the following code:
HTML CODE/TEXT HERE
<div><img height="230" alt="" src="/RAS/uploads/Physical inventory frequency.JPG"/></div>
When I display that code in my web aplication (browser) the image is being displayed, but the generated word document is showing the big red cross.
I need some help please.
Hello
Thanks for your request. I think in your case you should specify URL">
I use this code for testing:
string baseUri = "<base href='http://localhost'/>";
builder.InsertHtml(baseUri + "<img alt='' src='../images/1.jpg' />");
Best regards,
Hi Andrey!
I try your suggestion but it is still not working! I have the same behavoir. The image is displaying fine in the web application, but the word document is displaying the red X.
Maybe I’m doing something wrong. My HTML is:
HTML CODE/TEXT HERE
<base href='http://localhost'/><img height="230" alt="" src="../RAS/uploads/Physical inventory frequency.JPG"/>
Any other suggestion?
I appreciate your support!
Hello
Thanks for your request. I cannot reproduce this problem on my side using the latest version of Aspose.Words (9.8.0).
You can download the latest version from here:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx
If it does not help, could you please attach your image and the output document here for testing?
Best regards,
Andrey, I’m still having the issue.
Please check the attached rar file, it contains the following files:
- Img1.jpg - This is my web application, I use a control editor for generating some formatted text and inserting images.
- Img2.jpg - This is the HTML code generated by the control.
- Img3.jpg - This is the generated document (Image)
- SIEPList.docx - This is the generated word document.
- HandleMergeFieldInsertHtml.txt - This is the handler used not only for rendering the html code, but also for inserting some images.
Please let me know if you have any other idea about this issue.
I appreciate your time.
Best regards!
Hi
Thank you for additional information. Have you tried specifying full path to the image? Is the image properly displayed in this case?
Also, please try to remove dots before the path to the image. Dots means one level upper, but as a base url you specified url of the site so there is no levels upper.
Best regards,
Alexey.
I tried to specify the image URL without dots and full URL, but the image is not displayed yet in word. The image is loogking fine only on the web app. Here is my html code:
This is a test for images!!!
<img height="336" alt="" src="http://myDomain/RAS/uploads/021.jpg" width="448" border="0" />
Any other suggestion?
Thanks for your reply.
Hi.
It seems that it is a permission issue because I tried de following html:
<img src="http://myDomain/RAS/uploads/021.jpg"/>
<img src="http://myDomain/OtherFolder/021.jpg"/>
I can see both images in my browser, but when I export to word, only one image is ok and the other one is the red cross.
Im going to use the other folder to store my images in order to avoid this issue.
Anyway, I don´t know if it is just the folder permisson or some IIS permisson. I would like to know what kind of permissons are needed by the aspose.word component in order to reder the images.
Thanks!!!
Hi
Thanks for your request. Yes, this might be a reason. Aspose.Words should have rights to read images. In this case, it can insert them into the final document.
If this is the reason, you can try using the technique suggested here to work the problem around :
http://www.aspose.com/community/forums/271402/inserthtml-with-protected-image-behind-url/showthread.aspx#271402
Best regards,