ActiveReports 6 Online Help
Rdf Viewer Sample

The RDF Viewer sample consists of an RdfViewerForm with an ActiveReports Viewer control, and an ExportForm with a Property Grid. The sample also contains an RDFs folder of saved reports.

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 for each of these, right-click the form and select View Code.

Code

The GetReportDoc property gets the Document object from the viewer. The ExportForm uses this property to export report documents.

The OpenToolStripMenuItem Click event filters to show only RDF files and opens the Open File dialog to the RDFs folder. The dlgOpenFile FileOK function loads the selected RDF file into the viewer.

The ExportToolStripMenuItem Click event opens a new ExportForm. Each of the other menu item click events performs its function in a straightforward manner.

For more information on the Viewer control, see Viewing Reports.

ExportForm

This form contains a combo box 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.

Code

The overloaded Show method allows the ExportForm to be called as a child object of the RdfViewerForm.

The Export Format combo box SelectIndexChanged event sets the exportComponent variable and the pgOptions property grid's SelectedObject to the selected export type.

The exportComponent 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.

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 without running it or accessing data. For more information, see Save and Load Report Files (RDF).

The following five reports are included in this sample:

See Also

Getting Started