Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TCustomdxComponentPrinter.AddLink(TComponent) Method

Creates a new report link for the specified component and adds the created link to the collection.

#Declaration

Delphi
function AddLink(AComponent: 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.

#Returns

Type Description
TBasedxReportLink

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 (AComponent) determines the actual report link class.

Important

The function returns nil (in Delphi) or nullptr (in C++Builder) if one of the following conditions is met:

  • The target component passed as the AComponent is not supported (has no registered report link classes).
  • The application project does not include the unit (in Delphi) or header (in C++Builder) file that declares the required report link class.

#Remarks

Call the AddLink function to create a new report link and associate it with the component (AComponent). The created report link has the same owner as the TdxComponentPrinter component.

Note

To use the AddLink or AddLinkEx 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. AddLink and AddLinkEx functions return nil (in Delphi) or nullptr (in C++Builder) if they cannot find the corresponding report link class declaration.

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
  AReportLink := dxComponentPrinter1.AddLink(dxPDFViewer1);
  try
    AReportLink.Print(False);  // Prints chart content without user interaction
  finally
    dxComponentPrinter1.DeleteLink(AReportLink.Index); // Deletes the report link after export
  end;
end;
See Also