1

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

4

3 回答 3

1

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

于 2009-02-19T09:34:05.470 回答
1

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.

于 2009-02-22T08:31:13.367 回答
0

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

from 999Tutorials

于 2009-02-19T09:37:35.243 回答