First steps with Flexcel

Hello,

Is there an example of how to connect DB master detail tables with  Excel templates via Flexcel 6 ? I have no legacy code so I haven't installed the version 3.

I have red all the manuals (API Developers Guide, Reports Designers Guide and Reports Developers Guide) but I don't know the necessary Delphi code once I have the Excel template setup.

Many thanks

Alberto

Hi,


Reports aren't available yet in v6. They are in testing, but not ready yet.

What you can do right now is to use the API to enter the cell values (using xlsFile.SetCellValue) or using the v3 report engine with the v6 xls/x engine. To use the v3 reports, you need to install them first (the download is below v6), and select to install "XlsxAdapter" when the setup suggest it. Then you use the v3 FlexCelReport as you would in the v3 demos, but connect it to an XlsxAdapter instead of XlsAdapter. This will allow you to do xls and xlsx reports, with more than 65536 rows (if you save as xlsx of course, xls doesn't allow that). As TXlsxAdapter uses FlexCel 6 to create the file, it will be faster, use less memory, recalculate the files, and support both xls and xlsx.

I see. Thank you very much for your help, Adrian

I have just installed the v3 FlexCel suite (the v6 was already installed and I haven't disinstalled).I ran the v3 demos and I have an error @[DCC Error] UGettingStarted.pas(19): E2003 Undeclared identifier: 'TXLSAdapter'

Strangely enough the form holds the component XLSAdapter1.

How can I solve this ?


Many thanks
Alberto

Alberto,


I am not really sure on what might be happening, maybe you have manually converted the XlsAdapter to XlsxAdapter?

In any case, even when the demos use TXlsAdapter because we want them to work standalone (even if you don't install FlexCel 6 and TXlsxAdapter), in all your work you should be using TXlsxAdapter now.

And you shouldn't really look at the "Getting started" or any "API" demos, since you should really be using the v6 API too. Look at the reporting demos and the XlsViewer demo, but ignore the API demos. There is no reason to use FlexCelImport today, use v6's TXlsFile instead (As shown in the v6 demos).

My first question would be: 1) Is the unit XLSAdapter in your uses clause? (it should be)

Then 2) If you create a new empty vcl app, drop a TXlsAdapter (and maybe a TXlsxAdapter), save and run, do you see the error?

3) Does this happen also with the Report demos?  What happens if you drop a TXlsxAdapter, connect the FlexCelImport/Report to the TXlsxAdapter instead of the TXlsAdapter and delete the TXlsAdapter? (which you should anyway)

Hello Adrian,

>maybe you have manually converted the XlsAdapter to XlsxAdapter?
Yes, this is what I did and everything worked perfectly. Thank you for your help.

For the records, in answer to your other questions:

>1) Is the unit XLSAdapter in your uses clause?
Yes, there is


> 2) If you create a new empty vcl app, drop a TXlsAdapter (and maybe a TXlsxAdapter), save and run, do you see the error?
No errors in this case.

>3) Does this happen also with the Report demos? 
Yes, it happened in all forms/datamodule where TXlsAdapter was already in.

>What happens if you
drop a TXlsxAdapter, connect the FlexCelImport/Report to the
TXlsxAdapter instead of the TXlsAdapter and delete the TXlsAdapter?
(which you should anyway)
This is what I did in the end and it solved the issue.


Again, thank you for your help.
Alberto