Would this work? If so do you know any jQuery plugins and PHP classes/functions to do so? If not, what is your ideas about it?
EDIT: Thanks to Matt, I came to the idea of using an XLS file template, is it possible? It will avoid me all the formatting as it would be done in the template file. Is it possible?
Yes, exactly that's why I thought of using jQuery to format it as HTML before sending it to PHP. Cheers
Commented Dec 10, 2010 at 17:30 i am thinking in the line of using ASP.NET, but i could be wrong. Commented Dec 10, 2010 at 17:32It sounds like you want the PHP file to screen scrape the jQuery generated page? This is not impossible (you can do so with the cUrl functions, take a look at this article) however if you can obtain the table data in any other way, it would be preferable. How is the table data originated? Is the table being edited by the user? Unless the user is adding content/styles, you should be able to pull the data from another source, and it will be easier.
First you should know there are primarily two methods to generate an Excel file in PHP:
Option 1 offers no styles whatsoever, just data.
Option 2 can add styles (though it's terribly obfuscated due to Excel's cumbersome format). Additionally, you have no guarantee the styles will translate to other applications (OO.org, StarOffice, Lotus, WP Office, etc.) - the XML will not be rendered consistently and your document styles will likely be lost or degraded.
If you have to resort to screen scraping, getting the css styles is going to be the most difficult part. Take a look at some of the solutions offered in this article for some ideas on how to get started.