Crystal reports (CR), a long-time Visual Studio add-in
staple, is not included out of the box with VS 2010 this time. Traditionally
CR has been the reporting tool of choice included with VS. While the Crystal
Report engine is not included with VS 2010, there is still a CR template included.
This template stubs your project as a Crystal Reports project. You can then
obtain the new CR for VS 2010 report engine by downloading it free of charge
from the SAP website. Currently that link is here.

This download includes a new WPF viewer for Windows Forms, which
has some nifty new features. There are also some performance gains when using
this.

This new viewer has not been released to the manufacturer
yet. However, it is currently in Beta, and the plan is to release it sometime
in November. Currently the viewer is in Beta 2, which is what this article is
based on. According to presentations from SAP, the footprint for Beta 2 is
larger than what it will be in the final release. However, Beta 2 is feature
complete. The intention right now is for this to be the last beta before
release in November.

New API features

According to information from SAP's Crystal folks, the
following are some new features you can find in the new API. Keep in mind this
is Beta information and is subject to change.

New Formatting events (report cannot be modified during
formatting event)

To get the latest version of Crystal for Visual Studio 2010,
you need to download this from the SAP site. Keep in mind that now Crystal
does not come directly bundled with VS 2010, but requires a download.

Visual Studio 2010 comes with a template for Crystal. You
are prompted to download Crystal Reports for Visual Studio 2010 from the SAP
website. Here is the link.

If you are installing beta 2 over a beta 1 installation,
remember to uninstall beta 1. This is accomplished by deleting the folder
where beta 1 was installed. While there currently is not a plan for a Beta 3, remember
to uninstall previous versions before installing a newer one.

Currently Beta 2 includes the bits for installation with VS
2010, the runtime for 32 bit and the runtime for 64 bit. These runtimes are
large files, but Crystal is promising to reduce the footprint in time for
release in November.

The new WPF viewer control to use in your windows
applications is a slick new control. It looks better and has some newer
features, as revealed in the API section above. As of Beta 2, binding a report
to the viewer is done most easily programmatically.

If you want to allow the end user some control of what
report to view, enable the property ShowOpenFileButton to allow the user to
select a report. Eventually there will be a property to set this, but you can
set the report to an embedded resource using code. For instance, in example 1,
the code shows how to bind an embedded resource to the report viewer.

CrystalReport1 is a report created in a project. To bind
this report to the new WPF viewer, use the property ViewerCore.ReportSource and
set it to the instance of the embedded report. Code Sample 1 shows the code.

The new
control does have better graphics. Besides better graphics the viewer also has
built in performance benefits. When filtering, if the data is not changed, the
data does not get refreshed.

For
instance, if you use a parameter to hide or show an object on your report, the
data would not be affected. In the report shown in Figure 1, there is a print
date that shows at the top of the report. An object like this would be perfect
to demonstrate the new refreshing strategy.

First, edit
the report. Add a parameter, named ShowPrintDate. Make that parameter Boolean
and set the default value to True. Select the object containg print date, and
open the format properties dialog box. On the common tab, select the formula
button beside the suppress checkbox. In that formula box, enter the formula
shown in code sample 2.

Listing 2

IIF ({?ShowPrintDate},False ,true )

That formula will allow you to toggle visibility of the
print object on the report. When you select and change that parameter, the
report will not go back to the data store to refresh the data. If you utilize
these types of dynamic parameters in your reports, you should see some
performance gains from this.

With this new control it is the little things that make the
new control worthwhile. For instance when paging through the report, there are
nice animated transitions. This makes the paging experience elegant for
users.

When the user of the report drills down, a tab opens within
the viewer. This way the report is open at the same time as the drill down.
It is extremely simple to get back to the original report this way. See Figure
2 for an example of this.

Figure 2

For the end user exporting, the addition of XLSX allows
exporting to a Microsoft Excel Workbook. Limited testing proved that this
export put the data in correct columns. That looks like a clean export
experience.

For the report designer the experience includes the ability
to preview the report while designing in Visual Studio. You can upgrade to
Crystal 2008 if you want the ability to edit on the preview page.

The new WPF viewer for Crystal reports is a nice addition to
your reporting aresenal. There have been nice incremental improvements,
including creating this as a WPF component. Keep in mind this is Beta 2. The
final release will be more stable and will have a smaller footprint.