[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
 [Expand]Product Information
 [Expand]Getting Started with DevExpress Reporting
 [Expand]Creating Popular Reports
 [Collapse]Detailed Guide to DevExpress Reporting
   Introduction to Banded Reports
  [Expand]Providing Data to Reports
  [Expand]Using Report Controls
  [Expand]Shaping Report Data
   Laying out Dynamic Report Contents
  [Expand]Customizing Appearance
  [Expand]Adding Navigation
  [Collapse]Providing Interactivity
    Creating Drill-Down Reports
    Sorting a Report in Print Preview
    Content Editing in Print Preview
    Print Preview Mouse Events
    Creating Drill-Through Reports
    Obtaining a Label's Text in Print Preview
  [Expand]Adding Customary Information
  [Expand]Merging Reports
  [Expand]Using Expressions
  [Expand]Storing and Distributing Reports
  [Expand]Reporting API
 [Expand]Visual Studio Report Designer
 [Expand]Creating End-User Reporting Applications
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
This documentation page describes implementations made in our v17.2 release cycle. To learn about functionality shipping with v18.1, navigate to our updated help file experience at docs.devexpress.com. Learn More

Obtaining a Label's Text in Print Preview

To obtain a label's text when clicking it in Print Preview, do the following:

  1. Start Microsoft Visual Studio 2010, 2012, 2013, 2015 or 2017 and create a new application under any of the supported platforms, or open an existing one.

  2. Add a new blank report to the application.

  3. Drop two XRLabel controls from the DX.18.1: Report Controls Toolbox tab onto the Detail band.

  4. To get a label's content in Print Preview, do one of the following (depending on the target platform):

    • Print Preview for Windows Forms

      Show Me

      A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1152.

      Handle the XRControl.PreviewClick and/or XRControl.PreviewDoubleClick events of the added controls in the following way:

      Run the application and click a label to view the result.

    • Document Preview for WPF

      Use the DocumentPreviewControl.DocumentPreviewMouseClick and/or DocumentPreviewControl.DocumentPreviewMouseDoubleClick events as shown in the code snippet below.

    • Web Document Viewer

      Handle the client-side ASPxClientWebDocumentViewer.PreviewClick event as demonstrated below.

Expanded See Also

Is this topic helpful?​​​​​​​