Recent

Author Topic: (SOLVED) Excel export  (Read 30490 times)

fabiopesaju

  • Jr. Member
  • **
  • Posts: 99
Re: (SOLVED) Excel export
« Reply #15 on: December 18, 2014, 11:40:09 am »
perfect. simple and easy...

but this code of xinyiman, I was more useful because I can adapt it to create more worksheets within the same spreadsheet. from what I saw, with fpsexport, I can not do anything but just one file with one spreadsheet ... correct?

wp

  • Hero Member
  • *****
  • Posts: 13630
Re: (SOLVED) Excel export
« Reply #16 on: December 18, 2014, 04:27:50 pm »
You are right, fpsExport creates a new spreadsheet file for each export. But: the procedure where this happens (DoBeforeExport) is virtual, you can replace it by your own procedure. Unfortunately, the variable for the destination worksheet is declared as private and therefore note available in the overridden version.

When I find some time I can try to modify the TFPSExport class such that multiple datasets can be put into the same file.

wp

  • Hero Member
  • *****
  • Posts: 13630
Re: (SOLVED) Excel export
« Reply #17 on: December 19, 2014, 03:57:48 pm »
In the current trunk version of fpspreadsheet, the database export (unit fpsexport) introduces a new property of the exporter: "MultipleSheets". If set to true the workbook is created only at the first call of the "Execute" method, and subsequent "Execute"s are stored in additional worksheets. Since the exporter does not know when all data have been written it is necessary to trigger saviing by calling "WriteExportFile". The name of the worksheets is defined by the FormatSettings of the exporter and/or by the handler of the OnGetSheetName event (some precaution is made to avoid duplicate sheet names).

See the db_import_export demo in the examples folder as an example.

 

TinyPortal © 2005-2018