|
Posted by C. (http://symcbean.blogspot.c on June 12, 2008, 8:11 am
Please log in for more thread options
> Hi all,
>
> I am displaying a number of reports, and giving the users an option to
> display them on the web or download them to Excel. If they want the
> Excel file, I just use the PHP header command to change the Content-
> Type and Content-Disposition headers, and essentially print the same
> report, and it's done. That works fine.
>
> But in some reports on the web I need to show images. The web part is
> fine, but I'm having a tough time figuring out how to actually display
> the images in Excel. Since this is a 'take it with you' file, links
> won't work. I assume I'll have to effectively store the entire real
> image file within Excel in the report. Can anyone point me in the
> right direction? Here's a code snippet:
>
> if ( ( isset($_POST['xl'])&&($_POST['xl']=="1") ) ||
> ( isset($_GET['xl'])&&($_GET['xl']=="1") ) ) {
> header("Content-Type: application/xls");
> header("Content-Disposition: attachment; filename=MyReport.xls");
> header("Content-Type: application/force-download");
> header("Cache-Control: post-check=0, pre-check=0", false);
> $xl = 1;
>
> }
>
> ...
> ...
>
> if ($xl == 1) {
> print "<img border=0 src='../report/$file' height=20>";}
>
> else {
> print "<img border=0 src='../report/$file' height=20>";
>
> }
>
> Presently the image part doesn't work for Excel. Thanks in advance.
>
> Eddie Andrews
What do you get if you manually create an Excel spreadsheet with
images, saving it as html, then viewing in a text editor?
C.
|