Previewing v2009 vol 1: Printing appointments from the WinForms scheduler

ctodx
19 February 2009

We locked the scheduler team and the reporting team in the same broom closet for a little while this release cycle to come up with a great reporting solution for all those WinForms applications that use the scheduler. And just before they keeled over from the lack of oxygen, they came up with an excellent addition to XtraScheduler that will allow you to produce professional diaries and PIM-style reports from your appointments. This new functionality is only available if you have both XtraScheduler and XtraReports (say, as part of DXperience Enterprise) since it makes use of features from both. Let's take a look.

First of all, one of the teams' main goals was to maintain as much flexibility as possible. This wasn't to be a "print screen" type solution, but a solution that should be designed. Hence the need for XtraReports: the new XtraScheduler Suite in v2009 vol 1 has a new control that descends from the XtraReport class called XtraSchedulerReport. This has the normal banded report designer that you're used to from XtraReports, and there are a set of new report controls that you can drop onto the designer surface to build up a scheduler report.

The report gets its data through a print adapter. The main purpose of this adapter object is to compose a data set that will be used in the report. We provide two print adapters: the SchedulerStoragePrintAdapter and SchedulerControlPrintAdapter. Since the print adapters provide a set of validation events, you can easily filter the scheduler data to suit the report. As an example, you could handle the SchedulerPrintAdapter.ValidateAppointments event in order to print appointments which meet some specific criteria.

The next layer is the report view. This is much like the view which exists in the XtraScheduler control, so there are ReportDayView, ReportWeekView, ReportTimelineView components.

Finally, as stated above, the report itself is a container for report bands, and each band has a set of controls placed inside them. We provide two distinct sets of controls.
image
The first, and most important set consists of controls that represent time cells with appointments. They are: DayViewTimeCells, HorizontalWeek, FullWeek, and TimelineCells. The second set of controls, the auxiliary controls if you like, include:

  • headers - the HorizontalResourceHeaders, VerticalResourceHeaders, HorizontalDateHeaders, DayOfWeekHeaders, and TimelineScaleHeaders.
  • calendar - the CalendarControl control
  • time ruler - the DayViewTimeRuler control
  • information - controls used to display miscellaneous information, such as the TimeIntervalInfo and ResourceInfo controls

They are similar to the XtraReport controls you know now (in that they're only there to drop on the report designer surface, you can't use them elsewhere), although they have their own peculiarities.

Since all that was a bit abstract, let's see how easy it is to create a professionally designed scheduler report.

  1. Open your XtraScheduler application.
  2. Choose Add New Item from the Project menu.
  3. Choose XtraScehduler Report Class. This will add a new blank scheduler report to your application.
  4. Visual Studio will display the report designer for the newly constructed instance (it's called XtraSchedulerReport1 by default). Open the Visual Studio Toolbox pane and open the DX: Scheduler Reporting tab. Drag and drop a DayViewTimeCells control onto the Detail Band of the report.
    image 
    You'll notice that an instance of the ReportDayView component is created automatically and placed in the component tray.
  5. Add a HorizontalResourceHeaders control. Place it above the DayViewTimeCells control, again in the Detail Band.
  6. Add a HorizontalDateHeaders control. Place it above the HorizontalResourceHeaders control, and resize it as needed. Its width will determine the width of the time cell area.
  7. Use the smart tag of the HorizontalResourceHeaders control to link it to the HorizontalDateHeaders control. Now the control is linked to the data provider (ReportDayView) and is anchored to the date headers.
  8. Use the smart tag of the DayViewTimeCells control to link it to the HorizontalResourceHeaders control.
  9. Add a DayViewTimeRuler control, and place it on the left side of the DayViewTimeCells control. Click its smart tag and link it to the DayViewTimeCells control. The time ruler is now also linked to the data provider (ReportDayView) and anchored to the time cells. Resize it if necessary for proper alignment.
  10. Add a TimeInfoControl and a CalendarControl to the Detail Band. Place them above all the other controls, at the top of the page. Use their smart tags to link them to the DayViewTimeCells control.

The resulting designer view looks like this. You can easily identify the various controls used (each has a link icon).

image

You can preview the report by clicking on the Preview tab in the designer. Within Visual Studio, some fake data is generated to populate the preview, however, if you invoke the end-user designer at run-time, the data you see will be "real".

Use the following code to create the report at run time and bind it to the Scheduler control in your application:

using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Reporting;
//...

      XtraSchedulerReport1 xr = new XtraSchedulerReport1();
      SchedulerControlPrintAdapter scPrintAdapter = new SchedulerControlPrintAdapter(this.schedulerControl1);
      xr.SchedulerAdapter = scPrintAdapter;

      xr.CreateDocument(true);
      xr.ShowPreview();

      // The line below invokes the End-User Designer
      //xr.ShowDesignerDialog();

The preview looks like this:

image

So, there you have it: creating a great-looking scheduler report in DXperience v2009 vol 1. Remember, although this is part of XtraScheduler, it does require XtraReports in order to function, so you must have licenses to both, or a license to a superset package containing them both, like DXperience Enterprise.

Not too long to go before we release, so be ready to enjoy using this new functionality when we do.

Free DevExpress Products – Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We’ll be happy to follow-up.
Eric Harmon_1
Eric Harmon_1

"allow you to produce professional dairies ..."

Great!  I can't tell you how long I've been wanting to write software for cows ;-)

19 February 2009
Linton
Linton

Kudo's to both teams...looks great!

19 February 2009
Julian Bucknall (DevExpress)
Julian Bucknall (DevExpress)

Eric: Doh! <forehead slap>

Cheers, Julian

19 February 2009
Boris Bosnjak
Boris Bosnjak

Man ,you guys make great stuff! :D

19 February 2009
Anonymous
GlenG

Eric, don't laugh... I actually *have* written a Diary for a Dairy.  I thought Julian was posting this for ME.

19 February 2009
Anonymous
Bob Thomas

Silly question, but have been burned in the past....  Will we be able to utilize this feature with the scaled down version of XtraReports provided within XAF?  

20 February 2009
Anonymous
kasyoki

Am waiting for this control with both hands since my project requires a schedule reporting module. Julian and devx team(mark . .mehul..x.x.... )keep the good work going.Regards

20 February 2009
Filippo Pensalfini
Filippo Pensalfini

That's nice and I really appreciate the work you guys do...what I don't like is that the *only* way to print a scheduler in timeline view is to buy the XtraReports suite. It doesn't seem quite right to me since every other view can be printed with built-in printing facilities.

I was happy that the suggestion titled "Add a new print style for the TimeLine view" had been implemented, only to discover that I had to buy a component that costs almost twice the scheduler. I have to admit that I feel a bit "cheated"...

20 February 2009
Neal
Neal

This is why DevExpress rocks!  You all continue to work so hard for us, the developers, the customers!  I am thrilled I landed on the DX suite and have no intentions of EVER leaving for another product!  It took me years but I finally made the RIGHT choice and for that I am thrilled!

Thank you DX!

20 February 2009
Sebastia Prat i Pons
Sebastia Prat i Pons

Hello Julian,

Really nice and useful feature for us!

Does will be available with XAF reporting?

Looking forward!

20 February 2009
Anonymous
Christian

That is great news! Will this work in XAF as well?

20 February 2009
Julian Bucknall (DevExpress)
Julian Bucknall (DevExpress)

Bob: Not sure what you mean by "scaled-down XtraReports with XAF". Since XAF is only available as part of DXperience Universal, and that contains the full XtraReports, I must be missing something.

Everyone: This should work just fine in XAF.

Filippo: Understood, but we had to make the decision. The vast majority of our customers who use XtraScheduler do not have just that Suite, but have some package of DXperience. We wanted to provide the maximum flexibility for the largest number of customers and that meant using XtraReports and especially the report designer (and the end-user report designer). We feel that this is the right thing to do for our customers.

Cheers, Julian

20 February 2009
MESUT KOSUCU
MESUT KOSUCU

Julian,

I am, and I am sure others too, are cant wait to see Gantt view in schedular control:) İn terms of your 2008 roadmap, I should have been implemented by now.. lol, is there anything new regarding it?

20 February 2009

Please login or register to post comments.