Back to Devexpress

TdxReportExportFormat Enum

vcl-dxbackend-ba66dab8.md

latest6.8 KB
Original Source

TdxReportExportFormat Enum

Enumerates formats available for report export operations.

Declaration

delphi
TdxReportExportFormat = (
    CSV,
    DOCX,
    HTML,
    Image,
    MHT,
    PDF,
    RTF,
    Text,
    XLS,
    XLSX
);

Members

NameDescriptionFormat-Specific Export Method
CSV

Comma-Separated Values (CSV)

|

TdxReport.ExportToCSV

| | DOCX |

Office Open XML Document (DOCX)

|

TdxReport.ExportToDOCX

| | HTML |

Hypertext Markup Language (HTML)

|

TdxReport.ExportToHTML

| | Image |

Image Export Format

The actual image format depends on Image Export Options available

in the Report Viewer dialog (the default image export format is PNG).

|

TdxReport.ExportToImage

| | MHT |

MIME HTML Document Format (MHT/MHTML)

|

TdxReport.ExportToMHT

| | PDF |

Portable Document Format (PDF)

|

TdxReport.ExportToPDF

| | RTF |

Rich Text Format (RTF)

|

TdxReport.ExportToRTF

| | Text |

Plain text format (TXT)

|

TdxReport.ExportToText

| | XLS |

Microsoft Excel® Binary Format (XLS)

|

TdxReport.ExportToXLS

| | XLSX |

Office OpenXML Spreadsheet Format (XLSX)

|

TdxReport.ExportToXLSX

|

Remarks

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

Users can configure each available export format in the Export Options pane.

Note

TdxReportExportFormat is a scoped enumeration type. Use the type name together with a scope resolution token (. in Delphi or :: in C++Builder) followed by an enumeration value to refer to this value. For example, use TdxReportExportFormat.XLSX (in Delphi) or TdxReportExportFormat::XLSX (in C++Builder) to refer to the XLSX value in code.

Code Example: Load and Populate Report Templates from Datasets

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;
  }
}

Direct TdxReportExportFormat Type References

The following public APIs reference the TdxReportExportFormats type:

AllReportExportFormatsA set of flags that corresponds to all export data formats available for the TdxReport component.TdxReportExportFormatsA set of flags that correspond to report data export formats.

TdxReportExportFormat Type References in Method Parameters

ExportTo(TdxReportExportFormat,TStream)Exports report content to a stream in any supported format.ExportTo(TdxReportExportFormat,TStream,string)Exports report content to a stream in any supported format. See Also

TdxDashboardExportFormat Type

TdxDashboardUIExportFormat Type

dxBackend Unit