ActiveReports 12
RDF Viewer
ActiveReports 12 > ActiveReports User Guide > Samples and Walkthroughs > Samples > Section Report > Preview > RDF Viewer

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>\Documents\GrapeCity Samples\ActiveReports 12\Section Reports\Preview\RDFViewer\VB.NET

C#

<User Folder>\Documents\GrapeCity Samples\ActiveReports 12\Section Reports\Preview\RDFViewer\C#

Run-Time 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:

  • Catalog.rdf
  • Customer Labels.rdf
  • Employee Profiles.rdf
  • Employee Sales.rdf
  • Invoice.rdf
  • Letter.rdf
See Also

Getting Started