Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Expand]Appearance
    [Expand]Data Binding
    [Expand]Data Exchange
    [Expand]DateTime
    [Expand]DateNavigator
    [Expand]Forms
    [Expand]Gantt View
    [Expand]Initialization
    [Expand]Labels and Statuses
    [Expand]Layout
    [Expand]Menu
    [Collapse]Printing and Reporting
      How to: Print a Scheduler and Show its Print Preview
      How to: Modify the Print Style and Hide the Mini-calendar from the Page Header
      How to: Export a Scheduler in PDF format
      How to: Print a Scheduler Using a Report Preview (Step-by-Step Guide)
      How to: Create an XtraSchedulerReport at Runtime
      How to: Create a Report without Visible Scheduler Control
    [Expand]Protection
    [Expand]Range Control
    [Expand]Recurrence
    [Expand]Reminders
    [Expand]Selection
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Print a Scheduler Using a Report Preview (Step-by-Step Guide)

This example illustrates how to create a printable report based on the Scheduler data, representing one of the Scheduler views.

This approach utilizes the XtraReports Suite to create a report containing controls specially designed to represent Scheduler elements. After the report is created, the Print Preview Form is invoked, which enables the end-user to print the report or export it to PDF.

This guide consists of the following sections:

Expanded Steps 1-3. Add a Scheduler Report to the Application

  1. Open the project that contains the SchedulerControl in the Microsoft Visual Studio Designer.
  2. In the PROJECT menu, select Add DevExpress Item -> New Item... to invoke the DevExpress Template Gallery dialog. Select the Scheduler Report template.

  3. Click Add Item to generate the code and add the file containing the XtraSchedulerReport class descendant to the project. The Report Designer for the newly created report is invoked automatically. It is illustrated in the following image.

Expanded Steps 4-6. Load a Report from a Template

Note

To create a report from scratch, skip to Step 7.

  1. To create a report, use one of the templates from the gallery of ready-to-use report layout templates. To connect to this gallery at design time within Visual Studio, click the report's smart tag, and in the invoked Report Tasks list, select the Load Report Template... link.

  2. In the invoked Report Templates dialog, select the template that best meets your requirements and click Load. You can also search for a specific template name using the search box.

  3. The selected report is immediately loaded into the Visual Studio designer.

Expanded Steps 7-15. Create a Report from Scratch

Note

If you have loaded a report from a template in steps 4-6, skip to step 16.

  1. To proceed with report creation, open the Toolbox pane (by pressing CTRL+ALT+X). Then, select the DayViewTimeCells control in the DX.17.1: Scheduler Reporting tab and drop it onto the report's DetailBand. Note that this tab is visible only if the XtraSchedulerReport class is opened in the Designer.

    Note

    The current implementation requires that report controls reside in the DetailBand only, and not in the other report bands.

  2. Add the HorizontalResourceHeaders control. Place it above the DayViewTimeCells control in the Detail Band.
  3. Add the HorizontalDateHeaders control. Place it above the HorizontalResourceHeaders control.
  4. Use the HorizontalResourceHeaders control's smart tag menu to link it to the HorizontalDateHeaders control.
  5. Use the DayViewTimeCells control's smart tag menu to link it to the HorizontalResourceHeaders control, as shown in the image below.

  6. Add the DayViewTimeRuler control, place it on the left side of the DayViewTimeCells control, click its smart tag and select the dayViewTimeCells1 in the DayViewTimeCells drop-down list. The time ruler is linked to the data provider (ReportDayView) and anchored to time cells.

  7. Drag the top and bottom edges of the DayViewTimeRuler to resize it. Its top border should be aligned to the top of the HorizontalDateHeaders control, and its bottom border should be aligned to the bottom of the DayViewTimeCells control. The visible scale of the DayViewTimeRuler starts at the offset from the top edge, which is specified by the ControlCornersOptions.Top property. To specify the offset in the Visual Studio Designer, click the smart tag of the DayViewTimeRuler and set the TopCornerIndent value, as illustrated in the following image.

  8. Add the TimeIntervalInfo control and the CalendarControl to the Detail Band. Place them above the other controls, at the top of the page. The controls bind themselves to the DayViewTimeCells control automatically. Arrange the controls on a page by resizing and moving them. The resulting report is shown below.

  9. Use the Detail band's smart tag menu to specify that the page break is inserted after the band, as illustrated in the following image.

You can save the report layout as a template for subsequent use in other applications. For this, click the report's smart tag, and in the invoked Report Tasks list, select the Save... link.

Expanded Steps 16-17. Display the Report

  1. Use the following code in your application to create a report at runtime, bind it to the Scheduler control and invoke the Preview dialog.

    Show Me

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

  2. Run the application and execute the code. The report preview is shown in the image below.

Expanded See Also

How would you rate this topic?​​​​​​​