Back to Devexpress

TdxReport.ExportFormats Property

vcl-dxreport-dot-tdxreport-2b6410a8.md

latest4.4 KB
Original Source

TdxReport.ExportFormats Property

Specifies export formats available in the Report Viewer dialog.

Declaration

delphi
property ExportFormats: TdxReportExportFormats read; write; default AllReportExportFormats;

Property Value

TypeDefaultDescription
TdxReportExportFormatsAllReportExportFormats

The set of flags that correspond to individual supported export formats.

|

Remarks

The Web-based Report Viewer dialog lists multiple export formats and corresponding settings available to users.

You can use the ExportFormats property to change the list of available export formats.

Code Example: Populate Templates and Export Reports

This code example loads an XML-based report template (REPX) from a dataset, configures export settings, populates the template with data from another dataset, and displays the report preview:

delphi
uses
  dxReport, // Declares the TdxReport component and related types
  dxBackend.ConnectionString.JSON.DataSet; // Declares the TdxBackendDataSetJSONConnection component
// ...

procedure TMyForm.Button1Click(Sender: TObject);
var
  ADataConnection: TdxBackendDataSetJSONConnection;
  AReport: TdxReport;
  ALayoutStream: TStream;
begin
  ADataConnection := TdxBackendDataSetJSONConnection.Create(Self);
  try
    ADataConnection.Name := 'DataSetJSONData';
    ADataConnection.DataSets.Add('Data', FDataSource);
    AReport := TdxReport.Create(Self);
    try
      AReport.ReportName := 'Report';
      ALayoutStream := FLayoutDataSet.CreateBlobStream(FLayoutDataSet.FieldByName('Layout'), bmRead);
      try
        AReport.Layout.LoadFromStream(ALayoutStream);
      finally
        ALayoutStream.Free;
      end;
      AReport.Language := 'fr-FR';
      AReport.ExportFormats := [TdxReportExportFormat.PDF,
        TdxReportExportFormat.RTF, TdxReportExportFormat.HTML];
      AReport.FilterString := 'id = 5';
      AReport.ShowViewer;
    finally
      AReport.Free;
    end;
  finally
    ADataConnection.Free;
  end;
end;
cpp
#include "dxReport.hpp" // Declares the TdxReport component and related types
#include "dxBackend.ConnectionString.JSON.DataSet.hpp" // Declares the TdxBackendDataSetJSONConnection component

// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxReport" // Required to use dxReport.hpp declarations
#pragma link "dxBackend.ConnectionString.JSON.DataSet" //Required to use TdxBackendDataSetJSONConnection declarations
// ...

void __fastcall TMyForm::Button1Click(TObject *Sender)
{
  TdxBackendDataSetJSONConnection *ADataConnection;
  TdxReport *AReport;
  TStream *ALayoutStream;
  ADataConnection = new TdxBackendDataSetJSONConnection(this);
  try
  {
    ADataConnection->Name = "DataSetJSONData";
    ADataConnection->DataSets->Add("Data", FDataSource);
    AReport = new TdxReport(this);
    try
    {
      AReport->ReportName = "Report";
      ALayoutStream = FLayoutDataSet->CreateBlobStream(FLayoutDataSet->FieldByName("Layout"), bmRead);
      try
      {
        AReport->Layout->LoadFromStream(ALayoutStream);
      }
      __finally
      {
        delete ALayoutStream;
      }
      AReport->Language = "fr-FR";
      AReport->ExportFormats = TdxReportExportFormats() << TdxReportExportFormat::PDF
        << TdxReportExportFormat::RTF << TdxReportExportFormat::HTML;
      AReport->FilterString = "id = 5";
      AReport->ShowViewer();
    }
    __finally
    {
      delete AReport;
    }
  }
  __finally
  {
    delete ADataConnection;
  }
}

Default Value

The ExportFormats property’s default value is the AllReportExportFormats global constant.

See Also

TdxReport.ShowViewer Procedure

TdxReport.ExportTo Procedure

TdxReport.OnExport Event

TdxReport Class

TdxReport Members

dxReport Unit