ActiveReports 8 > ActiveReports User Guide > Samples and Walkthroughs > Samples > Section Report > Preview > RDF Viewer Sample |
The RDF Viewer sample is used to view RDF files. It consists of an RdfViewerForm with an ActiveReports Viewer control and an ExportForm with a Property Grid. The sample also contains a RDFs folder of saved reports.
Sample Location
Visual Basic.NET
<User Folder>\ComponentOne Samples\ActiveReports 8\Section Reports\VB.NET\Peview\RDFViewer
C#
<User Folder>\ComponentOne Samples\ActiveReports 8\Section Reports\C#\Preview\RDFViewer
Runtime features
When you run the sample, a Viewer control containing File and View menu appears on the top. Following options are available in given menus.
File menu
View menu
Project Details
ExportForm
This form contains a Combobox to collect the user-selected export format, a property grid to display properties for the selected format, and an OK button to export the report to the selected format. It also contains a Save dialog. Right-click the form and select View Code to see how this is done.
The Export Format ComboBox's SelectedIndexChanged event sets the cmbExportFormat variable to the selected export type. The cmbExportFormat variable is picked up in the OK button Click event, and then the report Document is pulled from the Viewer and exported to the selected format.
RdfViewerForm
This form contains an ActiveReports Viewer control with its Dock property set to Fill. This ensures that the viewer resizes along with the form at run time. It also contains a MenuStrip and an OpenFile dialog. To see the code implementation of this form, right-click the form and select View Code.
The Click event of the Open option in the File menu filters to show only RDF files and opens the Open File dialog to the RDFs folder. The dlgOpenFile_FileOK event loads the selected RDF file into the Viewer control. The Click event of the Export option in the File menu opens a new ExportForm. For more information on the Viewer control, see Using the Viewer.
RDFs folder
An RDF file is a static copy of a report saved to the native Report Document Format. This can be loaded into the Viewer control without running it or accessing data. For more information, see Save and Load RDF Report Files.
The following five reports are included in this sample: