[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Expand]Data Binding
    [Expand]Data Editing
    [Expand]Data Presentation
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
     [Expand]Context Menus
     [Expand]Export and Import Data
     [Collapse]Print TreeList
       Customize Print Appearances
       Customize TreeList Print Settings
       Printing Basics
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[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]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)

Printing Basics

This topic covers how to print a Tree List layout and show a print preview for the control.

The TreeList.ShowPrintPreview and TreeList.ShowRibbonPrintPreview methods open a window with print commands and a print preview of the current Tree List control. When using the first method, the print commands are displayed using the Bars UI, while the second method displays the print commands using a Ribbon UI. Using the Preview window, an end-user is able to customize the page settings (the page format, margins and orientation), provide a background image for pages, specify which Tree List elements must be printed, export the Tree List to various formats (PDF, HTML. XLS, Image, etc), and so on.

The TreeList.Print method prints the Tree List control immediately, without showing a preview, using the default page settings. Before calling this method, you can specify which Tree List elements must be printed. To do this, use the properties provided by the TreeList.OptionsPrint object. This object also provides settings that specify whether to expand nodes before printing, whether columns must be stretched to fit the page width, etc.

You can also use the TreeList.PrintDialog method to display the standard Print dialog, which allows you to select a printer and its settings, and then start or cancel the print operation.

The TreeList.ShowPrintPreview, TreeList.ShowRibbonPrintPreview and TreeList.Print methods provide basic printing capabilities. For information on advanced printing capabilities (e.g., setting the paper size and margins beforehand, add headers and footers to the printout, etc.), see How to: Set Paper Format and Add Custom Information to the Report when Printing/Exporting a Control.

Expanded Example

The following example demonstrates how to print a TreeList with the TreeList.Print method, and show its print preview with the TreeList.ShowRibbonPrintPreview method.

The image below shows the Preview window for a sample Tree List control. The print commands provided by this window are displayed using a Ribbon UI.

Expanded See Also

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