Back to Devexpress

TCustomdxComponentPrinter.AddEmptyLinkEx(TdxReportLinkClass,TComponent) Method

vcl-dxpscore-dot-tcustomdxcomponentprinter-dot-addemptylinkex-x28-dxpscore-dot-tdxreportlinkclass-system-dot-classes-dot-tcomponent-x29.md

latest3.8 KB
Original Source

TCustomdxComponentPrinter.AddEmptyLinkEx(TdxReportLinkClass,TComponent) Method

Creates a new report link and adds it to the collection.

Declaration

delphi
function AddEmptyLinkEx(ALinkClass: TdxReportLinkClass; AOwner: TComponent): TBasedxReportLink;

Parameters

NameTypeDescription
ALinkClassTdxReportLinkClass

The reference to the required report link class.

| | AOwner | TComponent |

The owner component for the created report link.

The owner component automatically destroys the associated report link when the application destroys the component. You can call the DeleteLink procedure to destroy the created report link manually.

|

Returns

TypeDescription
TBasedxReportLink

Returns the created report link.

Cast the returned object to the corresponding terminal report link class to access all public API members. The ALinkClass parameter specifies the actual report link type.

|

Remarks

Call the AddEmptyLinkEx function to create a new empty (non-configured) report link of any required type.

The created report link is not associated with a source control. You need to use the link’s Component property to specify the content source control.

Tip

AddLink and AddLinkEx functions automatically associate the created report link with the specified parent control.

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:

delphi
uses
  dxPSdxPDFViewerLnk; // Declares the TdxPDFViewerReportLink class
// ...
var
  AReportLink: TBasedxReportLink;
begin
  // Creates a PDF Viewer control report link
  AReportLink := dxComponentPrinter1.AddEmptyLinkEx(TdxPDFViewerReportLink, dxPDFViewer1);
  AReportLink.Component := dxPDFViewer1; // Associates the created report link with the source control
  try
    AReportLink.Print(False); // Prints chart content without user interaction
  finally
    dxComponentPrinter1.DeleteLink(AReportLink.Index); // Deletes the report link after export
  end;
end;
cpp
#include "dxPSdxPDFViewerLnk.hpp" // Declares the TdxPDFViewerReportLink class
// ...
  TBasedxReportLink *AReportLink;
  // Creates a PDF Viewer control report link
  AReportLink = dxComponentPrinter1->AddEmptyLinkEx(__classid(TdxPDFViewerReportLink), dxPDFViewer1);
  AReportLink->Component = dxPDFViewer1; // Associates the created report link with the source control
  try
  {
    AReportLink->Print(false); // Prints chart content without user interaction
  }
  __finally
  {
    dxComponentPrinter1->DeleteLink(AReportLink->Index); // Deletes the report link after export
  }

See Also

TCustomdxComponentPrinter.AddEmptyLink Function

TCustomdxComponentPrinter.AddLink Function

TCustomdxComponentPrinter Class

TCustomdxComponentPrinter Members

dxPSCore Unit