Since Crystal Reports is fully integrated with Visual Studio .NET, you may be tempted to think that creating a new report is a simple matter that only takes a minute or two. While this is true after you have a little experience, creating a report the first time can be confusing if you don’t follow the proper steps. This chapter shows you what steps are required and how to do them, providing you with a foundation for all chapters to follow. After writing a couple of reports, these steps become second nature. There are two parts to learn: creating a report and printing a report.
Creating a Report
Reports are files that must be created with the Visual Studio IDE. This requires opening a project and building the files within it. Adding a report to a project involves 5 steps. Each step has different options that you need to consider before implementing it.
Table 2-1. Steps for writing a report.
Step | Description |
---|---|
1. Creating a new report file | From the menu, select Project/Add New Item. Follow the prompts to select the report type. |
2. Running the report experts | Use the different report experts to identify the tables and fields to print and get a good start in the right direction. This is optional. |
3. Setting the designer’s defaults | Make sure your development environment is the way you want it before working on your report. |
4. Adding report objects to the report | Add the different objects that your report needs. These objects consist of textboxes, fields, etc. |
5. Formatting the objects | Set the properties of the objects so that they are formatted properly. These properties consists of fonts, sizes, etc. |
Before you add a report to your project, you need to know what your reporting goals are, and how the report will help fulfill these goals for your application. None of the options presented here are complex, you just need to be aware of what they are in advance. The following sections explain each step in detail and tell you what you need to consider when doing each one. The last section of the chapter, Coding Samples, pulls together everything you learned in this chapter and shows sample code of how to print and preview reports.