As you are adding the columns, the default data type is string. Go to the Properties windows after selecting a column to change it from string to Int32. After you are done with adding columns, it should look similar to Figure 6. Figure 6: DataTable after adding needed columns So far we’ve created the project, and added a CRV and a DataSet. It’s time to work on the report. Following are the steps required to add Report (rptXMLData.rpt ): Select Add -> New Item -> Crystal Report from Solution Explorer. Change the name from CrystalReport1.rpt to rptXMLData.rpt and click the Add button to complete the action. A dialog box of Crystal Reports Gallery will appear. Select “As a Blank Report” option and clickthe OK button to complete the process to add report. By default, you will see that rptXMLData.rpt is open for you in designer mode and its default setting. For this example I’ll make use of only Page Header and Footer. I’ll reduce the height ofReport Header and Footer. Typically, after all this your report designer should look similar to Figure 7. Figure 7: Newly added report in design mode
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Adding a report to the project is easy. The challenge is to fill in the empty report layout. Whether
this is your first report or you are a reporting junkie like me; we must deal with the most basic
building blocks of the report writing. That is, the header, the detail, and the footer.
Typically, reports are designed with specific page size and layout in mind. Our report is Letter
size and Portrait layout. You can explore various properties attached to the report layout by right-clicking anywhere on the open designer surface (gray area) and selecting Report and Design
Properties.
It is always advisable to draw a prototype of your report on paper before you start the design
process. As you can see in Figure 1, we have the report name and report date in the header
section. The body section has the employee list information; the footer carries the page numbers.
Header Section
Our header section is consists of five Text Object, two Line Object and one Special Field.
Please drag and drop Text Object and Line Object from Toolbox -> Crystal Reports. You candrag and drop the “Print Date” special field from Field Explorer -> Special Fields -> Print Date.
You’ll also notice that I’ve changed the color and font after placing the report object on the
designer surface. Please make sure your header looks similar to Figure 8.
Once the report source is specified, all we have to do is drag and drop the fields from DataTable
inside Detail section on report designer surface. You can drag and drop all the fields fromDataTable starting with “Title” from Field Explorer inside the details section.
As you drag and drop the fields inside the detail section, you’ll notice that the title of the field is
also added to report designer. Since we’ve already taken care of field header, just delete the
default added field header. Please make sure the final report designer layout looks similar to