Exporting images to excel?

P

Paulo

Hi, using the following code:
<%
Response.Buffer
Response.AddHeader "Content-Disposition",
"attachment;filename=Relatorio_Individual.xls"
Response.ContentType = "application/vnd.ms-excel"
%>
<table width="805" border="1" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#660000" align="center" colspan="5" height="19"><img
src="imagens/logo.gif"></td>
<td bgcolor="#660000" align="center" colspan="5" height="19">
<font face="arial" size="3" color="#FFFFFF">
<b>QUILOMBO - Avaliação de Desempenho - Relatório Individual</b>
</font>
</td>
</tr>
</table>

.... here goes the rest of code, connecting db, etc...

%>

but the "imagens/logo.gif" doesnt show on Excel... it appears a X (just like
when the image was not found)
and I need it on my excel report...

How can I do that?

Thanks in advance!
 
A

Anthony Jones

Paulo said:
Hi, using the following code:
<%
Response.Buffer
Response.AddHeader "Content-Disposition",
"attachment;filename=Relatorio_Individual.xls"
Response.ContentType = "application/vnd.ms-excel"
%>
<table width="805" border="1" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#660000" align="center" colspan="5" height="19"><img
src="imagens/logo.gif"></td>
<td bgcolor="#660000" align="center" colspan="5" height="19">
<font face="arial" size="3" color="#FFFFFF">
<b>QUILOMBO - Avaliação de Desempenho - Relatório Individual</b>
</font>
</td>
</tr>
</table>

... here goes the rest of code, connecting db, etc...

%>

but the "imagens/logo.gif" doesnt show on Excel... it appears a X (just like
when the image was not found)
and I need it on my excel report...

How can I do that?


The problem is with the attachment keyword present in the
Content-Disposition the document is downloaded as a file and opened as a
file in Excel. Therefore any relative references to images will be relative
to the folder that the file is opened from.

Do you need to download it as a file or could you load it in-browser?
Alternatively you could set the src attributes of the images to use full URL
like:- http://yourserverFQDN/images/logo.gif

Whatever the approach you use the client must have the ability to access
that content, it isn't encoded into the file itself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top