writing Excel files through PHP

This is a discussion on writing Excel files through PHP within the PHP General forums, part of the PHP Programming Forums category; Hi all, I m generating an Excel file though PHP by sending the appropriate header and then using HTML <...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-10-2004
Binay
 
Posts: n/a
Default writing Excel files through PHP


Hi all,

I m generating an Excel file though PHP by sending the appropriate header and then using HTML <TD> tags to write data in different cells. Below is my code snippet.

It has got 1 problems:

1. Image doesn't come/showup in Excel sheet.

<?php

header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=pareto_combined.xls");
?>

<tr colspan=8>
<td height=50> <img src='../../../extra/images/log.jpg'></td>
<td align=right><img src='../../../extra/images/mickey_sup.jpg'></td>
</tr>

<?php
$dateF=$_REQUEST['dateF'];

$dateT=$_REQUEST['dateT'];

$agentID=$_REQUEST['agentID'];
<tr>
<td class='graybg'><?php echo $agentID</td>
<td class='graybg'><?php echo $dateF</td>
<td class='graybg'><?php echo $dateT</td>
</tr>

?>

now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application.

So my question is how can i display the images in Excel using PHP? plz help me out

Thanks in advance

Binay



Reply With Quote
  #2 (permalink)  
Old 01-10-2004
Marek Kilimajer
 
Posts: n/a
Default Re: [PHP] writing Excel files through PHP

Use full uri. But the user needs to be online while viewing the xls file.

Other option is to create web archive. It's a mime encoded file, save an
excel file with an embeded image and you will see what it is.

Binay wrote:
> Hi all,
>
> I m generating an Excel file though PHP by sending the appropriate header and then using HTML <TD> tags to write data in different cells. Below is my code snippet.
>
> It has got 1 problems:
>
> 1. Image doesn't come/showup in Excel sheet.
>
> <?php
>
> header("Content-type: application/vnd.ms-excel");
> header("Content-disposition: attachment; filename=pareto_combined.xls");
> ?>
>
> <tr colspan=8>
> <td height=50> <img src='../../../extra/images/log.jpg'></td>
> <td align=right><img src='../../../extra/images/mickey_sup.jpg'></td>
> </tr>
>
> <?php
> $dateF=$_REQUEST['dateF'];
>
> $dateT=$_REQUEST['dateT'];
>
> $agentID=$_REQUEST['agentID'];
> <tr>
> <td class='graybg'><?php echo $agentID</td>
> <td class='graybg'><?php echo $dateF</td>
> <td class='graybg'><?php echo $dateT</td>
> </tr>
>
> ?>
>
> now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application.
>
> So my question is how can i display the images in Excel using PHP? plz help me out
>
> Thanks in advance
>
> Binay
>
>
>

Reply With Quote
  #3 (permalink)  
Old 01-10-2004
Greg Beaver
 
Posts: n/a
Default Re: writing Excel files through PHP

Hi,

You might also consider using Spreadsheet_Excel_Writer

http://pear.php.net/package/Spreadsheet_Excel_Writer

Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org

Binay wrote:
> Hi all,
>
> I m generating an Excel file though PHP by sending the appropriate header and then using HTML <TD> tags to write data in different cells. Below is my code snippet.
>
> It has got 1 problems:
>
> 1. Image doesn't come/showup in Excel sheet.
>
> <?php
>
> header("Content-type: application/vnd.ms-excel");
> header("Content-disposition: attachment; filename=pareto_combined.xls");
> ?>
>
> <tr colspan=8>
> <td height=50> <img src='../../../extra/images/log.jpg'></td>
> <td align=right><img src='../../../extra/images/mickey_sup.jpg'></td>
> </tr>
>
> <?php
> $dateF=$_REQUEST['dateF'];
>
> $dateT=$_REQUEST['dateT'];
>
> $agentID=$_REQUEST['agentID'];
> <tr>
> <td class='graybg'><?php echo $agentID</td>
> <td class='graybg'><?php echo $dateF</td>
> <td class='graybg'><?php echo $dateT</td>
> </tr>
>
> ?>
>
> now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application.
>
> So my question is how can i display the images in Excel using PHP? plz help me out
>
> Thanks in advance
>
> Binay
>
>
>

Reply With Quote
  #4 (permalink)  
Old 01-12-2004
Binay
 
Posts: n/a
Default Re: [PHP] writing Excel files through PHP

Hi Marek,

Thanks for replying ..I have got few questions based on ur suggestions.. plz
find it embedded in your reply.

Thanks
Binay
----- Original Message -----
From: "Marek Kilimajer" <kilimajer@webglobe.sk>
To: "Binay" <binay@oliveinternet.com>
Cc: <php-general@lists.php.net>
Sent: Saturday, January 10, 2004 6:52 PM
Subject: Re: [php] writing Excel files through PHP


> Use full uri. But the user needs to be online while viewing the xls file.
>
> Other option is to create web archive. It's a mime encoded file, save an
> excel file with an embeded image and you will see what it is.

+++++++++++++++++++++++++++++
How to create web archvie which will be mime encoded file and then saving as
excel file .. plz direct me to the resources where i can find more
information about it .. or tell me how can i proceed to it.
Thanks
+++++++++++++++++++++++++++++


>
> Binay wrote:
> > Hi all,
> >
> > I m generating an Excel file though PHP by sending the appropriate

header and then using HTML <TD> tags to write data in different cells. Below
is my code snippet.
> >
> > It has got 1 problems:
> >
> > 1. Image doesn't come/showup in Excel sheet.
> >
> > <?php
> >
> > header("Content-type: application/vnd.ms-excel");
> > header("Content-disposition: attachment; filename=pareto_combined.xls");
> > ?>
> >
> > <tr colspan=8>
> > <td height=50> <img src='../../../extra/images/log.jpg'></td>
> > <td align=right><img src='../../../extra/images/mickey_sup.jpg'></td>
> > </tr>
> >
> > <?php
> > $dateF=$_REQUEST['dateF'];
> >
> > $dateT=$_REQUEST['dateT'];
> >
> > $agentID=$_REQUEST['agentID'];
> > <tr>
> > <td class='graybg'><?php echo $agentID</td>
> > <td class='graybg'><?php echo $dateF</td>
> > <td class='graybg'><?php echo $dateT</td>
> > </tr>
> >
> > ?>
> >
> > now after saving the Excel file it displays all alphanumeric data

correctly but images do not show up. i think Img tag is not supported by
Excel application.
> >
> > So my question is how can i display the images in Excel using PHP? plz

help me out
> >
> > Thanks in advance
> >
> > Binay
> >
> >
> >

Reply With Quote
  #5 (permalink)  
Old 01-12-2004
Tristan Pretty
 
Posts: n/a
Default Re: [PHP] writing Excel files through PHP

You know, I've been struggling with this probelm fr ages, and wouldn't you
know it, I really over complicated things..
using this simple header method, I've done it...

Cheers for the heads up...
It pays to read eh? ;-)

Tris..





Marek Kilimajer <kilimajer@webglobe.sk>
10/01/2004 13:22

To
Binay <binay@oliveinternet.com>
cc
php-general@lists.php.net
Subject
Re: [php] writing Excel files through PHP






Use full uri. But the user needs to be online while viewing the xls file.

Other option is to create web archive. It's a mime encoded file, save an
excel file with an embeded image and you will see what it is.

Binay wrote:
> Hi all,
>
> I m generating an Excel file though PHP by sending the appropriate

header and then using HTML <TD> tags to write data in different cells.
Below is my code snippet.
>
> It has got 1 problems:
>
> 1. Image doesn't come/showup in Excel sheet.
>
> <?php
>
> header("Content-type: application/vnd.ms-excel");
> header("Content-disposition: attachment; filename=pareto_combined.xls");
> ?>
>
> <tr colspan=8>
> <td height=50> <img src='../../../extra/images/log.jpg'></td>
> <td align=right><img src='../../../extra/images/mickey_sup.jpg'></td>
> </tr>
>
> <?php
> $dateF=$_REQUEST['dateF'];
>
> $dateT=$_REQUEST['dateT'];
>
> $agentID=$_REQUEST['agentID'];
> <tr>
> <td class='graybg'><?php echo $agentID</td>
> <td class='graybg'><?php echo $dateF</td>
> <td class='graybg'><?php echo $dateT</td>
> </tr>
>
> ?>
>
> now after saving the Excel file it displays all alphanumeric data

correctly but images do not show up. i think Img tag is not supported by
Excel application.
>
> So my question is how can i display the images in Excel using PHP? plz

help me out
>
> Thanks in advance
>
> Binay
>
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




************************************************** *******************
The information contained in this e-mail message is intended only for
the personal and confidential use of the recipient(s) named above.
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original message.
************************************************** *********************


Reply With Quote
  #6 (permalink)  
Old 01-12-2004
Marek Kilimajer
 
Posts: n/a
Default Re: [PHP] writing Excel files through PHP

Binay wrote:
> +++++++++++++++++++++++++++++
> How to create web archvie which will be mime encoded file and then saving as
> excel file .. plz direct me to the resources where i can find more
> information about it .. or tell me how can i proceed to it.
> Thanks
> +++++++++++++++++++++++++++++
>


Web archive is a simple textfile (zipped if I remember well) very
similar to multipart emails. To see how it looks save a spreadsheet in
web archive format, give the file zip extension and unzip it.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:37 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0