JqueryHelp
JqueryHelp

Reputation: 21

How to display/export an image on an excel spreadsheet with cfcontent

I have a cfcontent tag exporting an excel spreadsheet, and I am are trying to place a logo on top of the excel spreadsheet.I have tried displaying the logo with an image tag, a cfimage tag, and none of the tags display the image on the spreadsheet. The output of the spreadsheet just displays the image as "The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location". The image is not in the root directory. Is there any other way to display/export an image on a cfcontent

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  

<style>
<!--table
page
{mso-page-orientation:landscape;}
-->
</style>  
</head>
<body>
    <img src="images/Logo.jpg" /> 
    #TheVaribleforExcelOutput#
</body>
</html>

Upvotes: 1

Views: 1016

Answers (2)

JqueryHelp
JqueryHelp

Reputation: 21

This will do it http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-796e.html

First we read the image and then have it placed in an image output i.e. in an image source.

<cfscript> 
    myImage=ImageRead("http://www.google.com/images/logo.gif"); 
    ImageWrite(myImage,"google-logo.gif"); 
</cfscript> 
<p>This image has been downloaded by ColdFusion:</p> 
<img src="google-logo.gif"> 
<p>This is the original image:</p> 
<img src="http://www.google.com/images/logo.gif"/>

Upvotes: 0

Mark A Kruger
Mark A Kruger

Reputation: 7193

Not sure if this is your answer, but an Excel spreadsheet is going to be a standalone file. There's no "host" associated with it. So if you want an extermal resource attached to it you will need an absolute path as in:

<img srce="http://myexample.com/images/logo.jpg">

Not sure that will work, but give it a shot. I seem to remember something similar in the distant past. :)

Upvotes: 1

Related Questions