Create and View Reports in a WinForms Application
- 2 minutes to read
This topic describes how an end-user can create and view a report at runtime in a WinForms application. There are two ways to create an end-user report. The first is to copy a predefined report using the Copy Predefined Report () button and then edit it. The second is to create a new report from scratch.
To create a report at runtime, do the following.
- Choose the Reports item in the Navigation.
- Click New.
In the invoked Report Wizard dialog, specify the following.
- Display Name - the report’s name.
- Data Type - the business object type to be used in the report. Only the types that have the DefaultClassOptionsAttribute or VisibleInReportsAttribute attribute applied can be chosen.
- Report Type - the report’s type (Standard or Label Report)
- Follow the wizard’s prompts to select report columns, and specify other settings.
Finally, the new report will be opened in the Report Designer, which provides advanced report layout customization options.
In the component tray, you can see that the data source component has already been added and assigned to the report’s DataSource property. The data source’s ObjectTypeName property is set to the business object type specified in the first page of the Report Wizard.
When the VisibleInReports attribute is applied to a business class property, it specifies whether or not the target property is visible in the Report Designer field list. In the Report Designer, you can modify the existing fields layout and add more fields.
After a report is saved in the designer, it is added to the Reports List View. You can double-click a report to preview it in a Print Preview Form.