Step 1 — Control Printing Basics
- 3 minutes to read
This topic contains basic information on VCL control printing capabilities using the standard TListBox component as an example.
Tip
The core print-related APIs are designed for simple document generation scenarios and print/content export operations available for the majority of DevExpress VCL Controls (shipped as part of ExpressQuantum Pack, VCL Subscription, and VCL Subscription+).
For most advanced report generation and BI/data analytics usage scenarios, we recommend that you use our ExpressReports and ExpressDashboards Suites (available as part of the VCL Subscription +). These advanced solutions include both the powerful report generator and customizable print preview, BI dashboard designer and viewer for data analytics (available both at design- and runtime), smart/AI functions, non-GUI/service-based document generation, and much more.

Create & Configure a RAD Studio Project
Create a new Delphi or C++Builder project and place the TdxComponentPrinter component on a form.

Add a TListBox component and select it. Click the button for the Items property in the Object Inspector to display the collection editor dialog. Create five items as demonstrated in the following image and click the OK button to confirm the changes.

Configure the Component Printer
Right-click the TdxComponentPrinter component and choose ReportLinks… from the context menu to display the print link collection editor.

Click the Add… button to display the Add Report dialog. Select the list box control from the list of available sources and click the OK button to create a print link for the list box.

Tip
You can rename the print link component using the Name field within the Add Report dialog.
Close the collection editor.
Display the Print Preview Dialog at Runtime
Add a TcxButton component on a form and change the button’s caption to Print the ListBox. Handle the button’s OnClick event handler as follows to display the Print Preview dialog for the TListBox component at runtime:
uses
dxPSCore, // Declares the TdxComponentPrinter component and related types
dxPSLbxLnk, // Declares the TdxListBoxReportLink component
cxButtons; // Declares the TcxButton component
// ...
procedure TMyForm.cxPrintButtonClick(Sender: TObject);
begin
dxComponentPrinter1.Preview(True, dxListBoxReportLink1);
end;
Run & Test the App
Run the application and click the Print the ListBox button to display the Print Preview dialog.

You can save TListBox control content to a file using the File | Save… menu option.

The Save As dialog allows you to select the target folder and specify the required file name. You can load a previously saved print document using the Load… menu item. The Unload option allows you to restore previously displayed document after a load operation.
Print Content Without User Interaction (Optional)
To print control content without user interaction, you can call the following TdxComponentPrinter methods:
- TCustomdxComponentPrinter.Print
- Prints a report on the default printer.
- TCustomdxComponentPrinter.PrintEx
- Prints report pages.
- TCustomdxComponentPrinter.Preview
- Activates the Print Preview dialog.
Tip
Refer to the TdxComponentPrinter class description for detailed information (including code examples) on all available options.
Next Step
The next step demonstrates print layout and appearance customization using the built-in UI.