The Report Designer


Like the original Crystal Reports for Visual Studio .NET product, Crystal Reports XI provides an integrated report designer inside of the Visual Studio .NET development environment. This edition of the report designer enables you to create and edit reports from within the comfort of Visual Studio .NET. Figure 29.1 shows the report designer in action.

Figure 29.1. This is a report being designed in the Visual Studio .NET Report Designer.


To add a new report to a project, select Add New Item from the Project menu. Select Crystal Reports from the Add New Item dialog. The filename you use here maps to the name of the report file as well as the name of the class created behind the scenes for the report (called the code-behind class).

Note

Many of you may be familiar with the Visual Basic report designer that was part of the Report Designer Component package made for Visual Basic 6.0. This new Visual Studio .NET report designer is the evolution of that component and works in a very similar manner.


After selecting Crystal Reports from the Add New Item dialog, the Report Wizard will be displayed. Select Using the Report Wizard or As a Blank Report to create a new report from scratch. The From an Existing Report option provides the capability to import any existing Crystal Report file (.rpt) and use the Visual Studio .NET report designer to make further modifications. This is a great way to leverage any existing work an organization has put into Crystal Reports. A report that is added or imported into a Visual Studio .NET project is just a standard RPT file. This means the standalone report designer can also be used to edit the report. The Visual Studio .NET Report Designer supports almost all the features of the standalone report designer and can be used to create everything from simple tabular reports to highly formatted professional reports. Although the feature set of these two editions of the designer are almost exactly the same, there are a few things for which the standalone designer is good, namely being able to preview the report without having to run the application.

Tip

A quick way to launch the standalone designer from within Visual Studio .NET is to right-click on a report in the Solution Explorer and select Open With. In the dialog that opens, select crw32.exe. This is the executable for the standalone report designer. This usually proves to be a better method to build reports anyway because you have a built-in and active preview screen available for dynamic viewing, editing, and testing.


Even though the capabilities of the two editions of the designers are similar, there are some differences in the way the designer works. This is not meant to be inconsistent, but rather to adapt some of the standalone report designer tasks to tasks that Visual Studio .NET developers would be familiar with. Ideally, the experience of designing a report with the Visual Studio .NET report designer should be like designing a Windows Form. The following sections cover these differences.

Understanding the Report Designer's User Interface Conventions

Several user interface components work differently in the Visual Studio .NET report designer. One of the first things you'll notice is that the section names are shown above each section on a section band as opposed to being on the left side of the window. However, the same options are available when right-clicking on the section band. This actually takes up less real estate and tends to be preferred by developers.

The Field Explorer resides to the left of the report page by default but can be docked anywhere as per most Visual Studio .NET tool windows. The Field Explorer can be easily shown or hidden by clicking the Toggle Field View button on the designer toolbar. Other explorer windows found in the standalone designer such as the Report Explorer and Repository Explorer are not available in the Visual Studio .NET report designer.

Note

Reports that contain objects linked to the Crystal Repository are fully supported; however, no new repository objects can be added to the report without using the standalone designer.


The menus that you would normally find in the standalone report designer can be found by right-clicking on an empty spot on the designer surface. The pop-up menu provides the same functionality.

The Property Browser

To change the formatting and settings for report objects in the standalone designer, users are familiar with right-clicking on a report object and selecting Format Field from the pop-up menu. This would open the Format Editor, which would give you access to changing font, color, styles, and other formatting options. In the Visual Studio .NET report designer, this scenario is still available; however, there is an additional way to apply most of these formatting optionsvia the Property Browser.

The Property Browser is a window that lives inside the Visual Studio .NET development environment. It should be very familiar to developers as a way to change the appearance and behavior of a selected object on a form or design surface. In the context of the report designer, the property browser is another way to change the settings (properties) for report objects. In general, any setting that is available in the Format Editor dialog is available from the property browser when that object is selected. This generally proves to be a faster and better way to set properties than using the Format Editor. To see which properties are available for a given object, click to highlight the object, and then check out the Property Browser window shown in Figure 29.2.

Figure 29.2. Using the Property Browser window to modify a report object's settings.


The property names are listed on the left and the current values are listed on the right. To click a value simply click on the current value and either type or select from the drop-down list.

One property to pay attention to is the Name property. This becomes relevant in the next section when you learn how to use the Report Engine Object Model to manipulate the report on the fly at runtime. This is the way to reference that object in code.




Crystal Reports XI(c) Official Guide
Crystal Reports XI Official Guide
ISBN: 0672329174
EAN: 2147483647
Year: N/A
Pages: 365

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net