Skip to main content
All docs
V25.2
  • TdxDashboard.ExportToXLSX(string) Method

    Exports dashboard content to a file in the Office OpenXML Spreadsheet Format (XLSX).

    Declaration

    procedure ExportToXLSX(const AFileName: string); overload;

    Parameters

    Name Type Description
    AFileName string

    An absolute or relative path to the target file.

    Remarks

    Call the ExportToXLSX procedure to export dashboard content to a file in the XLSX format.

    Code Example: Export Dashboard Content to XLSX File Without User Interaction

    The following code example configures a memory-based data source (TdxBackendInMemoryJSONConnection), loads an XML dashboard layout, and exports dashboard content to a XLSX file without user interaction:

    uses
      dxBackend.ConnectionString.JSON,  // Declares the TdxBackendInMemoryJSONConnection component
      dxDashboard;                      // Declares the TdxDashboard class
    // ...
    
    procedure TMyForm.cxExportButtonClick(Sender: TObject);
    var
      ADashboard: TdxDashboard;
      AJSONDataConnection: TdxBackendInMemoryJSONConnection;
      AJSONData: string;
    begin
      // Define a table that consists of three columns ("id", "Region", and "Sales") and five data rows:
      AJSONData :=
    
      '[{"id": 1, "Region": "Asia",          "Sales": 4.7685},' +  // Row #1
       '{"id": 2, "Region": "Australia",     "Sales": 1.9576},' +  // Row #2
       '{"id": 3, "Region": "Europe",        "Sales": 3.3579},' +  // Row #3
       '{"id": 4, "Region": "North America", "Sales": 3.7477},' +  // Row #4
       '{"id": 5, "Region": "South America", "Sales": 1.8237}]';   // Row #5
    
      AJSONDataConnection := TdxBackendInMemoryJSONConnection.Create(Self);  // Creates a data connection
      try
        AJSONDataConnection.Name := 'JSONData';        // Assigns a name to the created data connection
        AJSONDataConnection.SetJSONValue(AJSONData);   // Assigns the defined JSON data string
        ADashboard := TdxDashboard.Create(Self);       // Creates a TdxDashboard container
        try
          ADashboard.Layout.LoadFromFile('MyDashboardLayout.xml');  // Loads an XML dashboard layout
          ADashboard.Name := 'MyDashboard';                         // Defines a dashboard name
          ADashboard.ExportToXLSX(ADashboard.Name + '.xlsx');     // Saves the resulting XLSX file
        finally
          ADashboard.Free;              // Releases the TdxDashboard container
        end;
      finally
        AJSONDataConnection.Free;       // Releases the data connection
      end;
    end;
    

    Other Export Methods

    Export to File

    ExportTo
    Exports dashboard content to a stream in any supported format.
    ExportToCSV
    Exports dashboard content to a file in the comma-separated values (CSV) format.
    ExportToGIF
    Exports dashboard content to a file in the Graphics Interchange Format (GIF).
    ExportToJPG
    Exports dashboard content to a file in the Joint Photographic Experts Group (JPEG/JPG) format.
    ExportToPDF
    Exports dashboard content to a file in the Portable Document Format (PDF).
    ExportToPNG
    Exports dashboard content to a file in the Portable Network Graphics (PNG) format.
    ExportToSVG
    Exports dashboard content to a file in the Scalable Vector Graphics (SVG) format.
    ExportToXLS
    Exports dashboard content to a file in the Microsoft Excel® binary format (XLS).

    Export to Stream

    ExportTo
    Exports dashboard content to a stream in any supported format.
    ExportToCSV
    Exports dashboard content to a stream in the comma-separated values (CSV) format.
    ExportToGIF
    Exports dashboard content to a stream in the Graphics Interchange Format (GIF).
    ExportToJPG
    Exports dashboard content to a stream in the Joint Photographic Experts Group (JPEG/JPG) format.
    ExportToPDF
    Exports dashboard content to a stream in the Portable Document Format (PDF).
    ExportToPNG
    Exports dashboard content to a stream in the Portable Network Graphics (PNG) format.
    ExportToSVG
    Exports dashboard content to a stream in the Scalable Vector Graphics (SVG) format.
    ExportToXLS
    Exports dashboard content to a stream in the Microsoft Excel® binary format (XLS).
    ExportToXLSX
    Exports dashboard content to a stream in the Office OpenXML Spreadsheet Format (XLSX).
    See Also