vcl-dxdashboard-dot-control-dot-tdxcustomdashboardcontrol-dot-exporttopdf-x28-system-dot-classes-dot-tstream-x29.md
Exports dashboard content to a stream in the Portable Document Format (PDF).
procedure ExportToPDF(AStream: TStream);
| Name | Type | Description |
|---|---|---|
| AStream | TStream |
The target stream.
|
Call the ExportToPDF procedure to export dashboard content to a stream in the PDF format.
The following code example exports content of a configured TdxDashboardControl component to a file in the PDF format using an intermediary TMemoryStream object:
uses
dxDashboard.Control, // Declares the TdxDashboardControl component
dxShellDialogs; // Declares the TdxSaveFileDialog component
// ...
procedure TMyForm.cxButtonExportToPDFClick(Sender: TObject);
var
AStream: TMemoryStream;
begin
if not dxSaveFileDialog1.Execute(Handle) then Exit; // Displays the "Save File" dialog
AStream := TMemoryStream.Create; // Creates a stream as an intermediary container
try
dxDashboardControl1.ExportToPDF(AStream); // Exports content to a stream in the PDF format
AStream.SaveToFile(dxSaveFileDialog1.FileName); // Saves PDF stream content to a file
finally
AStream.Free; // Releases the intermediary memory stream
end;
end;
#include "dxDashboard.Control.hpp" // Declares the TdxDashboardControl component
#include "dxShellDialogs.hpp" // Declares the TdxSaveFileDialog component
// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxDashboard.Control" // Required to use dxDashboard.Control.hpp declarations
#pragma link "dxShellDialogs" // Required to use dxShellDialogs.hpp declarations
// ...
void __fastcall TMyForm::cxButtonExportToPDFClick(TObject *Sender)
{
if(!dxSaveFileDialog1->Execute(Handle)) { return; } // Displays the "Save File" dialog
TMemoryStream *AStream = new TMemoryStream(); // Creates a stream as an intermediary container
try
{
dxDashboardControl1->ExportToPDF(Handle); // Exports content to a stream in the PDF format
AStream->SaveToFile(dxSaveFileDialog1->FileName); // Saves PDF stream content to a file
}
__finally
{
delete AStream; // Releases the intermediary memory stream
}
}
To see the dashboard export functionality in action, run the BI Dashboards Designer/Viewer demo in the VCL Demo Center installed with compiled DevExpress VCL demos. Select any demo in the sidebar on the left, click the Export button, and use any export option listed in the menu.
Tip
You can find full source code for the installed compiled Report demo in the following folder:
_%PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressDashboards_
You can call the following procedures to export dashboard content to a stream in other formats:
ExportToExports dashboard content to a stream in any supported format.ExportToCSVExports dashboard content to a stream in the comma-separated values (CSV) format.ExportToGIFExports dashboard content to a stream in the Graphics Interchange Format (GIF).ExportToJPGExports dashboard content in the JPEG format.ExportToPNGExports dashboard content to a stream in the Portable Network Graphics (PNG) format.ExportToSVGExports dashboard content to a stream in the Scalable Vector Graphics (SVG) format.ExportToXLSExports dashboard content to a stream in the Microsoft Excel® binary format (XLS).ExportToXLSXExports dashboard content to a stream in the Office OpenXML Spreadsheet Format (XLSX). See Also
TdxDashboard.ExportTo Procedure
TdxReport.ExportToPDF Procedure
TdxCustomDashboardControl Class