Re: sending image to excel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It really seems that this list has missed its main topic a lonnnnng time ago.

Well anyway, here we go, Lal, it's not just you.

You're not really generating a .XLS file, only a .HTML disguised with
a .XLS extension. No problem about that, Excel can read it and render
it (in its own style, of course).

I really don't see a problem with your code, although I didn't debug
it, it just seems right. About the image, it REALLY should not have
any kind of problem. Excel can download the image from the given URL.
Here's an example of mine, it worked perfectly in HTML and also when
opened inside Excel.

As it's working and it's similar to what you provided, maybe you could
post the results you expect and those you are getting. I just
understood that the image is not showing, but if it shows in your
browser, it shouldn't have a problem being shown in Excel. Well, at
least, it's like that at a first sight. :-)

Well, here's my simple and stupid example:
------
<html>
<head><title>My Title</title>
</head>
<body>
<h1>Heading 1 Test</h1>
Something out of the body
<BR>
Here's the image:
<img src="http://gmail.google.com/gmail/help/images/logo.gif";>
<BR>
<BR>
<BR>
NOw this is after some BRs
</body>
</html>
------

Paste it in some text file, name it with a .HTML extension. It should
open okay. Now name it with a .XLS extension (as in your code) and
it'll also open, but you'll note some - expected - differences in
image rendering and positioning.

At least, here, it opened the GMail logo.

Cheers,
Charles.


On Wed, 16 Feb 2005 03:18:39 -0800 (PST), lal ram <rams_mbn@xxxxxxxxx> wrote:
> 
> Hi,
>   can any one help me to solve this problem.
> 
> I am trying to send HTML data to excel.But the HTML
> data
> contains image which i could not able to get in excel
> sheet.
> 
> The Code is:
> 
> echo ("<html><title>Report</title><body>");
>                echo ("<table width='100%' class='header' border='0'
> cellpadding='0' cellspacing='1'
> bordercolor='#B6C7E5'>");
>                if (isset ($image) && $image != '') {
> 
>                        echo (header("Content-type: ", "image/png"));
>                        echo ("<tr><td><IMG
> SRC='http://localhost/workspace/reports/includes/templates_c/{$image}'></td></tr>");
>                }
>                echo (header("Content-Type:
> application/octet-stream\n"));
>                echo (header("Content-Disposition: attachment;
> filename=extraction.xls"));
>                echo (header("Content-Transfer-Encoding:
> binary\n"));
>                echo ("<tr>");
>                for ($i = 0; $i < count($data); $i ++) {
>                        echo ("<td width='20%' height='30'
> bgcolor='#F2F4F8'>"."<div
> align='center'>{$data[$i]}</div>"."</td>");
>                }
>                echo ("</tr>");
>                echo ("<tr>");
>                for ($j = 0; $j < count($fields[0]); $j ++) {
>                        $i = 0;
>                        while ($i < count($fields)) {
>                                echo ("<td bgcolor='#EEEEEE'
> align='left'>{$fields[$i][$j]} </td>");
>                                $i ++;
>                        }
>                        echo ("</tr>");
>                        echo ("<tr>");
>                }
>                echo ("</tr>");
>                echo ("</tr>");
>                echo ("</table>");
>                echo ("</body></html>");


PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux