CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Export to Excel

Print topic Send  topic

Author Message
DataDoIt
Posted: 03/31/2004, 11:15 AM

CCS2; PHP; MySQL

I've looked through the forums and found an example of how to send data to
an Excel spreadsheet instead of to the browser. The sample I found for PHP
is:

In PHP&Templates this Page Open Event should work:
$header_filename = "";
$footer_filename = "";
Header("Content-type: application/vnd.ms-excel");

The steps I took were:

1. Created a blank page with a record grid on it, displaying records only,
no theme, showing a few fields of data.
2. Inserted the above custom code into the Page On Initialize View (also
tried Page After Initialize).

Whenever I go to access the page (localhost/ExcelSample.php), I get an IE
error about File "localhost/ExcelSample.php" cannot be found, followed by an
Excel error "Microsoft Excel cannot access localhost/ExcelSample.php, there
may be several possible reasons ... ".

Where in CCS should the above code go to make this work? Thanks.

-Mike R.

bguthrie


Posts: 31
Posted: 04/01/2004, 6:52 AM

Mike,

I'll send you a working example via e-mail.
_________________
Regards,

Bruce
View profile  Send private message
alexzblondu
Posted: 04/22/2004, 1:33 PM

bguthrie, could you please post the working example here, cause i have the same problem.
thank you.
bguthrie


Posts: 31
Posted: 04/22/2004, 6:54 PM

Please provide an e-mail address and I'll send the example to you.
_________________
Regards,

Bruce
View profile  Send private message
Ashiff
Posted: 04/23/2004, 5:46 AM

HI,

Use this in Open event

$header_filename = "";
$footer_filename = "";
Header("Content-type: application/vnd.ms-excel");
Header("Content-Disposition: attachment; filename=example.xls");
Header("Pragma: no-cache");
Header("Expires: 0");

This will help you download the excel file as example.xls posing to user whether to open or save. but IE must be atleast 6.0 for this to work as IE 5.5 has some issues.

I hope this works for you.

Don Safar
Posted: 08/12/2004, 9:22 PM

I need a working example in php of how to export an entire recordset for a
grid in to excel or csv format. The grid is on a page with a search form and
I need to add a link or button that will allow the user to export the grid
in the current record set.

If someone has one they will share please email to donsafar at hotmail dot
com. Thanks!

"DataDoIt" <mike@datadoit.com> wrote in message
news:c4f5da$pt6$1@news.codecharge.com...
> CCS2; PHP; MySQL
>
> I've looked through the forums and found an example of how to send data to
> an Excel spreadsheet instead of to the browser. The sample I found for
PHP
> is:
>
> In PHP&Templates this Page Open Event should work:
> $header_filename = "";
> $footer_filename = "";
> Header("Content-type: application/vnd.ms-excel");
>
> The steps I took were:
>
> 1. Created a blank page with a record grid on it, displaying records
only,
> no theme, showing a few fields of data.
> 2. Inserted the above custom code into the Page On Initialize View (also
> tried Page After Initialize).
>
> Whenever I go to access the page (localhost/ExcelSample.php), I get an IE
> error about File "localhost/ExcelSample.php" cannot be found, followed by
an
> Excel error "Microsoft Excel cannot access localhost/ExcelSample.php,
there
> may be several possible reasons ... ".
>
> Where in CCS should the above code go to make this work? Thanks.
>
> -Mike R.
>
>

Tam
Posted: 09/23/2004, 8:46 PM

Hi bguthrie,
I have struggling to figure this issue. If possible, would you please send the example to me?

Thank you.
Guy


Posts: 60
Posted: 09/24/2004, 1:14 PM

Hi bguthrie,
i'm interesting too for this example
Could ypu send me this example
Thank for advance
ggi@online.fr
_________________
CCS 3 - PHP 4 - MS SQL 2000 - IIS 5
Guy
View profile  Send private message
Tam
Posted: 09/25/2004, 10:25 AM

Oh, sorry, my email istamdang@earthlink.net. Thanks.
pookie62
Posted: 12/02/2004, 11:41 PM

Could anybody send me their examples too ???
Thanks very much !!!

Send it toclone4u2@hotmail.com
RaZ
Posted: 12/14/2004, 9:26 AM

Hello
I'm also intrested in that example. I need to export some content from a mysql db into excel.
Question: can i export only one part of the table in excel?
Thnks
RaZ
dataobjx


Posts: 181
Posted: 12/14/2004, 12:21 PM

CCS Developer Magazine Issue # 3 has an extensive tutorial on producing Excel spreadsheets using PHP.

For the amount of time it takes to research and implement this code from scratch, you may want to consider purchasing Issue #3.
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
aaike
Posted: 12/18/2004, 4:26 AM

Dear all,

It's a shame maybe, but I also am interested for the discussed script for generating a XLC file bij PHP from a online database . Could anybody send me some tips and scripts?

Thanks,
Aaike

(oorg@geo.vu.nl)
jerry
Posted: 12/21/2004, 10:37 AM

bguthrie, could you please post the working example here, cause i have the same problem.
thank you.
jim7567g

Posts: 38
Posted: 12/22/2004, 5:01 PM

I'm tring this free script:

http://www.apg88.com/apgForm/
_________________
Jim
View profile  Send private message
CCS4ever
Posted: 12/25/2004, 4:20 AM

This works

http://ccs.ath.cx/~ccs/SearchResults.php?s_keyword=excel

Bill
Posted: 12/27/2004, 9:41 AM

Hello, I too am searching for an export to .xls example. Could you please send it to me? Thanks in advance, Bill

Quote bguthrie:
Please provide an e-mail address and I'll send the example to you.
Bill
Posted: 12/27/2004, 9:42 AM

P.S. My email ishunter12@earthlink.net

Thanks again, Bill
ramsosa
Posted: 12/27/2004, 7:28 PM

<?
header("Content-type: application/vnd-ms-excel");
header("Content-Disposition: attachment; filename=textxls.xls");
?>
<html>
<head>
<title>Titulo</title>
</head>
<body>
Aqui Inicia el cuerpo del archivo
<table border=2 cellpadding=1 cellspacing=1>
<caption>Titulo de Tabla</caption>
<tr><th>Name<th>Address<th>Address2<th>Phone<th style="width:200px">Income</tr>
<tr><td>John<td>Street<td>US<td>="23993"<td>6,500.00</tr>
<tr><td>Antonio<td>21 St<td>Center Street<td>="29039"<td>4,000</tr>
<tr><td><td><td><td><td>=sum(e4..e5)</tr>
</table>
</body>
Jeremy
Posted: 01/18/2005, 8:27 AM

Bgutherie, could you also send me the example script on exporting a database to an excel document?

email:jhawver@c3consultant.com

Thanks,
Josh
Posted: 01/24/2005, 8:37 PM

I'm interested as well. Bgutherie, please send me the example. Thanks.

josh2780@yahoo.com
fai
Posted: 01/25/2005, 6:34 PM

Can you email me the example. Thanks....

dandanfaifai@yahoo.com.hk
freddy
Posted: 01/31/2005, 2:56 AM

and me please :)

lingwood5@hotmail.com
solara
Posted: 01/31/2005, 2:55 PM

Hi,

I got the example from Ramsosa to work without issue, that was:

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

Upon entering the page, IE prompts you to save the file. That works just fine, however, has anyone gotten this export to work with the images that are in the table? I have a pretty excell sheet right now, but no images that I have labled on the web page to show what you're looking at. :-/
solara
Posted: 01/31/2005, 3:01 PM

Ok, disregard my last question on my post. I got the images to go with the file. The trick is, you have to save the spreadsheet to a file folder within a directory, not to your desktop...just in case anyone else was having that issue. That's it! My report is all pretty again! :-D
leip
Posted: 02/08/2005, 4:19 PM

I can download the excel file posing to user whether to open or save. But i want automatically to it save into root dir. what shoud i do ?
James Stone
Posted: 10/03/2007, 2:19 PM

Can you please send me this example

James Stone
jstone@salesnavigator.ney


"bguthrie" <bguthrie@forum.codecharge> wrote in message
news:54088775d6b0ca@news.codecharge.com...
> Please provide an e-mail address and I'll send the example to you.
> _________________
> Regards,
>
> Bruce
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.