TCustomdxComponentPrinter.AddLinkEx(TComponent,TComponent) Method
Creates a new report link for the specified component and adds the created link to the collection.
#Declaration
function AddLinkEx(AComponent: TComponent; AOwner: TComponent): TBasedxReportLink;
#Parameters
Name | Type | Description |
---|---|---|
AComponent | TComponent | The target component for the created report link. The function automatically selects the report link class that corresponds to the target component type if your project includes the unit (in Delphi) or header (in C++Builder) where the report link class is declared. |
AOwner | TComponent | The owner component for the created report link. The owner component automatically deletes the associated report link when the application deletes the component. You can also call the Delete |
#Returns
Type | Description |
---|---|
TBasedx |
The created report link. Cast the returned object to the corresponding terminal report link class to access all public API members. The type of the target component ( Important The function returns
|
#Remarks
Call the AddLinkEx
function to create a new report link and associate it with the required component (AComponent
). Unlike AddLink the AddLinkEx
function allows you to assign the required owner component to the created report link (AOwner
).
Note
To use the AddAdd
function in your project, you need to include all units (in Delphi) or headers (in C++Builder) where all required report link classes are declared. AddAdd
functions return nil
(in Delphi) or nullptr
(in C++Builder) if they cannot find the corresponding report link class declaration.
#Code Example: Manage and Use Report Links at Runtime
The following code example creates a report link for an existing PDF Viewer control, prints its content without user interaction, and deletes the created report link:
uses
dxPSdxPDFViewerLnk; // This unit declares the TdxPDFViewerReportLink class
// ...
var
AReportLink: TBasedxReportLink;
begin
// Creates a PDF Viewer control report link and sets the application form as the link owner
AReportLink := dxComponentPrinter1.AddLinkEx(dxPDFViewer1, MyForm1);
try
AReportLink.Print(False); // Prints chart content without user interaction
finally
dxComponentPrinter1.DeleteLink(AReportLink.Index); // Deletes the report link after export
end;
end;