FlexReport for WPF | ComponentOne
FlexViewer for WPF / Quick Start: FlexViewer for WPF
In This Topic
    Quick Start: FlexViewer for WPF
    In This Topic

    The quick start guide familiarizes you with rendering a report in the FlexViewer control. In this section, you learn to load and render FlexReport to the FlexViewer control.

    To create a simple WPF application using the FlexViewer control, follow these steps:

    1. Loading the Report
    2. Rendering the Report

    Step 1: Loading the Report

    To load a report definition from a file, follow these steps:

    1. Create a new WPF Application in Visual Studio.
    2. Add the Button and C1FlexViewer controls to the XAML design. Set the Name of C1FlexViewer control as Viewer and adjust it height and width accordingly.
    3. Add FlexReport to your project. In our case, we have used a report named TelephoneBillReport.flxr, available in the FlexReport samples installed on the machine.
    4. Add the reference to C1.WPF.FlexReport.4.dll to the application.
    5. Add the following namespace in the code:
      • C1.WPF.FlexReport
    6. Add the following code in the Button_Click event in code view to load the report:
      Dim rep As New C1FlexReport()
      'load report definition
      rep.Load("..\..\TelephoneBillReport.flxr", "TelephoneBill")
      //load report definition
      C1FlexReport rep = new C1FlexReport();
      rep.Load(@"..\..\TelephoneBillReport.flxr", "TelephoneBill");
    Back to Top

    Step 2: Rendering the Report

    To render a report, you need to load the report first. Once the report definition has been created, a data source is defined, and the report definition is loaded, you can render the report to the FlexViewer control.

    Add the following code to the Button_Click event in the code view to render the FlexReport in FlexViewer control:

    'preview the report
    Viewer.DocumentSource = rep
    //preview the report
    Viewer.DocumentSource = rep;

    This is how the report appears on rendering to FlexViewer.

    Back to Top