RE: [PHP] PHP excel capability
| From: | tg-php at gryffyndevelopment dot com | Date: | Mon, 23 Apr 2007 18:32:49 +0000 |
| Subject: | RE: [PHP] PHP excel capability | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-253538@lists.php.net to get a copy of this message | ||
I had some issue when I tried CSV in the past. I don't know if there was some issue with use
of commas in the data and not getting Excel to properly use "some data, with commas",
"some more data" so that it'd omit the quotes as well or what. In the end, for the
quick and dirty throwaway project I was working on, HTML tables worked the best. Or at least
quicker than figuring out what our problem with CSV was.
Not the best solution, but was the best for what we needed and it's definitely worth noting
that CSV (making sure your data doesn't have commas or you properly compensate for that) and
HTML are both good quick and dirty download-to-Excel options.
And as Richard mentioned, COM requires Windows, but if you want to do anything with it, you need to
have something for PHP to talk to via COM. In this instance, we're talking about PHP + Excel.
There's little things you have to be careful with when using COM too, especially on your
server. Making sure you close the app that you're interacting with properly is one of the
biggest. You might issue a 'close' command and find out it only closes the document, not
the app as you might think. Suddely you have 50 instances of Excel running (non-visible) on your
server and you're up a creek.
COM is great to have as an option, but really isn't usually the best solution unless you have
no other choice.
-TG
= = = Original message = = =
On Wed, April 18, 2007 11:25 am, tg-php@gryffyndevelopment.com wrote:
> Also, if you output an HTML table and set the content type in your
> header to an Excel content type, it should ask the client PC to open
> the page in Excel (assuming they have it installed). This works for a
> real quick and dirty export-to-excel type thing. Then PHP isn't
> really creating an Excel file, but presenting the data in a format
> that Excel on the client PC can read.
If you output CSV format and send Excel content-type, that also works,
and may be a more natural coding than HTML tables.
Or not, depending on what you are doing. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.