Thursday, November 27, 2008

Re: Using PHP to export MySQL data MS excel files

Yes, it's definitely possible. But it's also definitely not easy.

Excel 2007's .xlsx format is simply a zip file containing a whole
bunch of XML files. You could write code that produce those xml files,
zips it up, call it xlsx and delivers it to the user.

A shortcut I commonly use is to produce an HTML table, and send that
to the client as an xls file (The RequestHandler in Cake makes it easy
to spoof your resultant view as a downloadable file). Excel is smart
enough to recognize an HTML table as tabular data and display it as
such. Excel 2007 will complain, but it will still handle it correctly.

You won't get any pie charts that way, though.

Anything else is going to likely cost you. Business intelligence and
reporting tools that can generate the kind of reports you're looking
for are generally very expensive (several thousand dollars), and are
difficult to integrate into an application.

Good luck,
James

On Nov 26, 1:54 am, liaogz82 <liaog...@gmail.com> wrote:
> Hi,
>
> I am looking into ways to use cakePHP to query into MySQL database to
> extract out the relevant data, then export out a report in MS excel
> that will include several pie charts. Such reports are to review by
> user on the browser first before it is being exported. Is there anyway
> to do it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: