In this scenario, an application generates reports using a fixed set of report definitions that are built into the application. This type of application does not rely on any external report definition files, and end-users can not modify these reports.
The main advantage of this type of application is that you don't need to distribute the report definition file, and you can be sure that no one can modify the report format. The disadvantage is that to make any modifications to the report, you must recompile the application.
If you want to use a report definition that you already have, without any modifications, follow these steps:
- Add one C1FlexReport component for each report definition you want to distribute. You may want to name each control after the report it will render (this will make your code easier to maintain).
- Right-click each C1FlexReport component and select the Load Report menu option to load report definitions into each control. (You can also click the smart tag () above the component to open the C1FlexReport Tasks menu and choose the Load Report option.)
The Load Report dialog box appears, which allows you to select a report definition file and then a report within that file.
To load a report, click the ellipsis button to select the report definition file you created in Step 1, then select the report from the drop-down list and click OK. The Load Report dialog box shows the name of the report you selected and a count of groups, sections, and fields. This is what the dialog box looks like:
- Add FlexViewer control to the form. Also, add a control that will allow the user to pick a report (this could be a menu, a list box, or a group of buttons).
- Add code to render the report selected by the user. For example, if you added a button in the previous step with the name btnProductsReport, the code would look like this:
Note that rptProducts is the name of the C1FlexReport component that contains the report selected by the user and c1FlexViewer1 is the name of the FlexViewer control.