Back to Devexpress

Printing Links

windowsforms-104-controls-and-libraries-printing-exporting-concepts-basic-terms-printing-links.md

latest3.5 KB
Original Source

Printing Links

  • Dec 23, 2019
  • 2 minutes to read

This topic provides an overview of the various approaches to create documents using printing links.

Among the different approaches to rendering documents from a component’s content, the easiest is to use a unified printing procedure, which is a printing link that transforms a control’s data into bricks of appropriate types, and arranges them into a printing document. You can use a printing link to print a non-visual component (such as a dataset) as well.

To print an object using a link at design time within Visual Studio, do the following.

  1. Drop the DocumentViewer component from the DX.25.2: Reporting Toolbox tab onto the main form of your application.

  2. To add a printing system to the print preview, select the DocumentViewer control and click its smart tag. Next, expand the Document Source property drop-down list, and select the PrintingSystem item in the Standard Sources category.

  3. To add a printing link of the required type to the PrintingSystem.Links collection, select the printing system in the component tray, click its smart tag, and click the ellipsis button for the Links property in the invoked actions list.

  4. In the invoked Link Collection Editor , click Add and select the required link type from the drop-down list.

  5. A property for associating an object with a link depends on the link type (e.g., the DataGridLink exposes the DataGridLinkBase.DataGrid property, and the PrintableComponentLinkBase exposes the PrintableComponentLinkBase.Component property).

To trigger document generation in code, call the Link.CreateDocument, Link.ShowPreview or Link.Print method.

To insert printing bricks into an existing document, use the corresponding methods of the BrickGraphics class. The Link will automatically associate the necessary brick types, so the BrickGraphics class creates compatible bricks and adds them to the document. For more information, refer to Brick Graphics.

See Also

How to: Use Link Events (Introduction)

Document Creation Approaches

Print Preview