Question

My PHP script have to create a multi-tabs Excel file with a report in each tab, but those reports already exists as HTML pages, so I don't want to duplicate code and work. I know I can rename a HTML file to .xls, and Excel/OpenOffice Calc will open it as a spreadsheet, but I don't know how to have severals tabs.

I do not even know if it is possible.

I already know Biffwriter and others PHP libs to create Excel file, but I am looking for a smarter solution.

Thanks, Cédric

Was it helpful?

Solution

Pear Excel Spreadsheet Writer has a function to create new Worksheets if thats what you are looking for.

OTHER TIPS

If you don't mind serving excel 2007 files, you can do this:

  1. create an excel 2007 file
  2. create all the tabs you need
  3. save the file
  4. rename the file as .zip
  5. extract the contents of the zip file

Now you can use the file structure there to populate the file corresponding to each tab with the report you need. You may want to use them as templates, keep the same code and render different files depending on whether you generate the html report of the excel report.

In the end, zip up the entire directory structure and serve it with an xlsx extension.

Please check the URLS of a library and turorials from IBM and

from 999Tutorials

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top