[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]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Collapse]Detailed Guide to DevExpress Reporting
   Introduction to Banded Reports
  [Expand]Provide Data to Reports
  [Expand]Use Report Controls
  [Expand]Shape Report Data
   Lay out Dynamic Report Contents
  [Expand]Customize Appearance
  [Expand]Add Navigation
  [Collapse]Provide Interactivity
    Create Drill-Down Reports
    Sort a Report in Print Preview
    Content Editing in Print Preview
    Print Preview Mouse Events
    Create Drill-Through Reports
    Obtain a Label's Text in Print Preview
  [Expand]Add Extra Information
  [Expand]Merge Reports
  [Expand]Use Expressions
  [Expand]Store and Distribute Reports
  [Expand]Reporting API
 [Expand]Visual Studio Report Designer
 [Expand]Create End-User Reporting Applications
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Obtain 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.2: 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

      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?​​​​​​​