Skip to main content
All docs
V25.1
  • TdxReport.OnLayoutChanged Event

    Allows you to save report layout changes made in the Report Designer dialog.

    Declaration

    property OnLayoutChanged: TdxReportNotifyEvent read; write;

    Remarks

    The TdxReport component generates report documents based on an XML-based report definition (template) in the REPX format. A REPX report definition contains report controls, properties, and data bindings. You can use the Layout property to access the current report layout.

    Handle the OnLayoutChanged event to execute custom code in response to report layout updates. For example, you can update the layout state in a custom storage every time the layout changes as demonstrated in the following code example: Save Report Layout Changes to a File.

    Event Occurrence

    The OnLayoutChanged event occurs in response to every Layout property value change.

    Event Parameter

    The ASender parameter provides access to the TdxReport component that raised the OnLayoutChanged event.

    Code Examples

    Save Report Layout to File on Every Change

    The following code example saves the current report to a REPX file every time a user saves pending changes in the Report Designer dialog:

    uses
      dxReport;  // Declares the TdxReport class
    // ...
    
    procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
    begin
      ASender.Layout.SaveToFile(ASender.ReportName + '.repx');
    end;
    

    Save Report Layout to Database on Every Change

    The following code example saves the current report to an existing BLOB dataset field every time a user saves pending changes in the Report Designer dialog:

    uses
      dxReport, // Declares the TdxReport class
      dxmdaset;  // Declares the TdxMemData class and related types
    // ...
    
    procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
    begin
      dxMemData1.Edit;
      dxMemData1.FieldByName('TemplateName').AsString := ASender.ReportName;
      dxMemData1.FieldByName('TemplateLayout').Assign(ASender.Layout);
      dxMemData1.Post;
    end;
    
    See Also