TFlexCelReport.AddTable Method
Overloads
- TFlexCelReport.AddTable(string, TArray<T>)
- TFlexCelReport.AddTable(string, TVirtualDataTable)
- TFlexCelReport.AddTable(string, TList<T>, TDisposeMode)
- TFlexCelReport.AddTable(TDataModule, TRecordCountMode, TDisposeMode)
- TFlexCelReport.AddTable(string, TVirtualDataTable, TDisposeMode)
- TFlexCelReport.AddTable(string, TDataSet, TRecordCountMode, TDisposeMode)
TFlexCelReport.AddTable(string, TArray<T>)
Use this method to tell FlexCel which DataTables are available for the report. Note: If you don't know the tables before running the report (and you are not using User Tables or Direct SQL) you can use the LoadTable event to load them in demand instead of using AddTable. This way you will only load the tables you need.
Syntax
Unit: FlexCel.Report
procedure TFlexCelReport.AddTable(const tableName: string; const table: TArray<T>); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | tableName | string | Name that the table will have on the report. |
const | table | TArray<T> | Array with data that we want to put into the report. |
Examples
To allow a report to use an Array of TCustomer objects you can use the code:
type
TCustomer = class
private
FName: string;
FBirthday: TDateTime;
public
property Name: string read FName;
Property Birthday: TDateTime read FBirthday;
end;
var
Customers: TArray<TCustomer>;
...
flexCelReport.AddTable<TCustomer>('Customers', Customers);
See also
TFlexCelReport.AddTable(string, TVirtualDataTable)
Use this method to add any custom object as a datasource for FlexCel. Make sure to read 'Appendix virtual datasets' in the Reports Developer Guide. Use AddTable(string, TDataSet, TRecordCountMode, TDisposeMode) to add datasets.
Syntax
Unit: FlexCel.Report
procedure TFlexCelReport.AddTable(const tableName: string; const table: TVirtualDataTable); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | tableName | string | Name that the table will have on the report. |
const | table | TVirtualDataTable | Table that will be available in the report. |
See also
TFlexCelReport.AddTable(string, TList<T>, TDisposeMode)
Use this method to tell FlexCel which DataTables are available for the report. Note: If you don't know the tables before running the report (and you are not using User Tables or Direct SQL) you can use the LoadTable event to load them in demand instead of using AddTable. This way you will only load the tables you need.
Syntax
Unit: FlexCel.Report
procedure TFlexCelReport.AddTable(const tableName: string; const table: TList<T>; const disposeMode: TDisposeMode = TDisposeMode.DoNotDispose); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | tableName | string | Name that the table will have on the report. |
const | table | TList<T> | TList with data that we want to put into the report. |
const | disposeMode | TDisposeMode | Optional: Default value is TDisposeMode.DoNotDispose When disposeMode is TDisposeMode.DisposeTable, FlexCel will take care of disposing this TList after running the report. Use it when adding tables created on the fly, so you do not have to dispose them yourself. |
Examples
To allow a report to use a TList of TCustomer objects you can use the code:
type
TCustomer = class
private
FName: string;
FBirthday: TDateTime;
public
property Name: string read FName;
Property Birthday: TDateTime read FBirthday;
end;
var
CustomerList: TObjectList<TCustomer>;
...
flexCelReport.AddTable<TCustomer>('Customers', CustomerList);
See also
TFlexCelReport.AddTable(TDataModule, TRecordCountMode, TDisposeMode)
Use this method to load all tables on a datamodule at once. When disposeMode is DoNotDispose, this is equivalent to calling AddTable(string, TDataSet, TRecordCountMode, TDisposeMode) for each of the tables on the dataset. If disposeMode is DisposeTable, this will make the same as calling AddTable() with disposeTable equal to false for each table on the dataset. And when finished all the datamodule will be disposed.
Syntax
Unit: FlexCel.Report
procedure TFlexCelReport.AddTable(const tables: TDataModule; const recordCountMode: TRecordCountMode = TRecordCountMode.Normal; const disposeMode: TDisposeMode = TDisposeMode.DoNotDispose); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | tables | TDataModule | Datamodule containing the tables to add. |
const | recordCountMode | TRecordCountMode | Optional: Default value is TRecordCountMode.Normal |
const | disposeMode | TDisposeMode | Optional: Default value is TDisposeMode.DoNotDispose When disposeMode is TDisposeMode.DisposeTable, FlexCel will take care of freeing this datamodule after running the report. Use it when adding datamodules created on the fly, so you do not have to free them yourself. |
See also
TFlexCelReport.AddTable(string, TVirtualDataTable, TDisposeMode)
Use this method to add any custom object as a datasource for FlexCel. Make sure to read 'Appendix virtual datasets' in the Reports Developer Guide. Use AddTable(string, TDataSet, TRecordCountMode, TDisposeMode) to add datasets.
Syntax
Unit: FlexCel.Report
procedure TFlexCelReport.AddTable(const tableName: string; const table: TVirtualDataTable; const disposeMode: TDisposeMode); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | tableName | string | Name that the table will have on the report. |
const | table | TVirtualDataTable | Table that will be available in the report. |
const | disposeMode | TDisposeMode | When disposeMode is TDisposeMode.DisposeTable, FlexCel will take care of freeing this table after running the report. Use it when adding tables created on the fly, so you do not have to free them yourself. |
See also
TFlexCelReport.AddTable(string, TDataSet, TRecordCountMode, TDisposeMode)
Use this method to tell FlexCel which DataTables are available for the report. Note: If you don't know the tables before running the report (and you are not using User Tables or Direct SQL) you can use the LoadTable event to load them in demand instead of using AddTable. This way you will only load the tables you need.
Syntax
Unit: FlexCel.Report
procedure TFlexCelReport.AddTable(const tableName: string; const table: TDataSet; const recordCountMode: TRecordCountMode = TRecordCountMode.Normal; const disposeMode: TDisposeMode = TDisposeMode.DoNotDispose); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | tableName | string | Name that the table will have on the report. |
const | table | TDataSet | Table that will be available to the report. |
const | recordCountMode | TRecordCountMode | Optional: Default value is TRecordCountMode.Normal When this property is SlowCount, FlexCel will loop over the records twice: once to get the number of rows to insert, and later to fill the values. Look at the section "About RecordCount in DataSets" in the reports developer guide. |
const | disposeMode | TDisposeMode | Optional: Default value is TDisposeMode.DoNotDispose When disposeMode is TDisposeMode.DisposeTable, FlexCel will take care of disposing this table after running the report. Use it when adding tables created on the fly, so you do not have to dispose them yourself. |
Examples
To allow a report to use Customers and Orders tables, you can use the code:
flexCelReport.AddTable('Customers', CustomersDataTable); //Add dataset Customers to the report.
flexCelReport.AddTable(MyDataModule); //Add all the tables on MyDataModule to the report.