Search Results for

    Show / Hide Table of Contents

    TFlexCelReport.LoadTable Event

    Fires whenever an undefined table is called, allowing to load your own datasets in demand to the report. For more control, you might use User Tables. Look at the example for more information.

    Syntax

    Unit: FlexCel.Report

    property TFlexCelReport.LoadTable: TLoadTableEventHandler

    Examples

    If you are running a report and don't know beforehand which tables it uses, you can use the following event:

    procedure OnLoadTable(const sender: TObject; const e: TLoadTableEventArgs);
    begin
      //Here GetTable is a method that returns the table to insert with our data.
      (sender as TFlexcelReport).AddTable(e.TableName, GetTable(e.TableName), TRecordCountMode.Normal, TDisposeMode.DisposeAfterRun);
    end;
    

    And the code:

      flexcelReport := TFlexCelReport.Create(true);
      try
        flexcelReport.LoadTable := OnLoadTable;
        flexcelReport.Run('Template.xlsx', 'Result.xlsx');
      finally
        flexcelReport.Free;
      end;
    

    Instead of using fr.AddTable for all used tables before running the report. If you need tables on demand, you might also look at User Tables or Direct SQL.

    See also

    • TFlexCelReport
    In This Article
    Back to top FlexCel Studio for VCL and FireMonkey v7.24
    © 2002 - 2025 tmssoftware.com