ComponentOne FlexReport for WinForms
Step 1 of 4: Creating a Report Definition
FlexReport Quick Start > Step 1 of 4: Creating a Report Definition

The following topic shows how you can create a report definition using the FlexReportDesigner application and the code. Note that creating a report definition is different from rendering a report. To render a report, you can simply load an existing definition and call the C1FlexReport.Render method. The easiest way to create a report definition is to use the C1FlexReportDesigner, which is a stand-alone application similar to the report designer in Microsoft Access and Crystal Report. You can find the detailed information about FlexReportDesigner and how it looks in About FlexReportDesigner.

The C1FlexReportDesigner.exe for 64 bit platform and C1FlexReportDesigner32.4.exe for 32 bit platform are located at C:\Program Files (x86)\ComponentOne\Apps\v4.0 on your computer.

Creating a Report Definition Using the FlexReportDesigner:

You can create a new report definition in FlexReportDesigner using FlexReport Wizard. The FlexReport Wizard walks you through the steps of creating a new report from start to finish. To begin, complete the following steps:

  1. Run the C1FlexReportDesigner.exe file from the location discussed in About FlexReportDesigner.
  2. Go to File Menu in the menu bar and select New command.
    Blank space appears in the FlexReportdesigner to create a new report.
  3. Click New Report drop down from the Reports tab located on the extreme left of designer and select Report Wizard.

    The FlexReport Wizard opens.

From the C1FlexReport Wizard, complete the following five steps to create your report:

  1. Select the data source for the new report.

    Use this page to select the DataSource.ConnectionString and DataSource.RecordSource that will be used to retrieve the data for the report.

    You can specify the DataSource.ConnectionString in three ways:

    • Type the string directly into the editor.
    • Use the drop-down list to select a recently used connection string (the Designer keeps a record of the last eight connection strings).
    • Click the ellipsis button (...) to bring up the standard connection string builder.

    You can specify the DataSource.RecordSource string in two ways:

    • Click the Table option and select a table from the list.
    • Click the SQL option and type (or paste) an SQL statement into the editor.

    Complete Step 1:

    Complete the following steps:

    1. Click the ellipsis button to bring up the standard connection string builder. The Data Link Properties dialog box opens.
    2. Select the Provider tab and select a data provider from the list. For this example, select Microsoft Jet 4.0 OLE DB Provider.
    3. Click the Next button or select the Connection tab. Now you must choose a data source.
    4. Click the ellipsis button to select a database. The Select Access Database dialog box appears. For this example, select the C1NWind.mdb located in the Common folder in the ComponentOne Samples directory (by default installed in the Documents folder). Note that this directory reflects the default installation path and its path may be different if you made changes to the installation path.
    5. Click Open. You can test the connection and click OK.
    6. Click OK to close the Data Link Properties dialog box.
    7. Once you have selected your data source, you can select a table, view, or stored procedure to provide the actual data. You can specify the DataSource.RecordSource string in two ways:
      • Select the Data source tab and select the Products table from the Tables list.
      • Select the SQL tab and type (or paste) an SQL statement into the editor.

        For example:

        select * from products
        FlexReport Wizard
    8. Click Next. The wizard will walk you through the remaining steps.
  2. Select the fields you want to include in the report.

    This page contains a list of the fields available from the recordset you selected in Step 1, and two lists that define the group and detail fields for the report. Group fields define how the data will be sorted and summarized, and detail fields define what information you want to appear in the report.

    You can move fields from one list to another by dragging them with your mouse pointer. Drag fields into the Detail list to include them in the report, or drag within the list to change their order. Drag fields back into the Available list to remove them from the report.

    Complete Step 2:

    Complete the following steps:

    1. With your mouse pointer, select the CategoryID field and drag it into the Groups list.
    2. Press the >> button to move the remaining fields into the Detail list.
       Selecting Fields in FlexReport Wizard
    3. Click Next. The wizard will walk you through the remaining steps.
  3. Select the layout for the new report.

    This page offers you several options to define how the data will be organized on the page. When you select a layout, a thumbnail preview appears on the left to give you an idea of what the layout will look like on the page. There are two groups of layouts, one for reports that have no groups and one for reports with groups. Select the layout that best approximates what you want the final report to look like.

    This page also allows you to select the page orientation and whether fields should be adjusted to fit the page width.

    The Labels layout option is used to print Avery-style labels. If you select this option, you will see a page that prompts you for the type of label you want to print.

    Complete Step 3:

    Complete the following steps:

    1. Keep the Outline layout.
      Selecting Layout in FlexReport Wizard
    2. Click Next. The wizard will walk you through the remaining steps.
  4. Select the style for the new report.

    This page allows you to select the fonts and colors that will be used in the new report. Like the previous page, it shows a preview to give you an idea of what each style looks like. Select the one that you like best (and remember, you can refine it and adjust the details later).

    Complete Step 4:

    1. Select the Verdana style.
      Selecting Style in FlexReport Wizard

    2. Click Next. The wizard will walk you through the remaining steps.

  5. Select a title for the new report.

    This last page allows you to select a title for the new report and to decide whether you would like to preview the new report right away or whether you would like to go into edit mode and start improving the design before previewing it.

    Complete Step 5:

    1. Enter a title for the new report, Products Report, for example.
      Enter Title in FlexReport Wizard
    2. Choose to Preview the report and click Finish.

      You will immediately see the report in the preview pane of the Designer.

You will notice that the report will require some adjustments.

You can invoke C1FlexReportDesigner from Visual Studio as well. To do so, complete the following steps:

  1. Create a .NET project and add the C1FlexReport component to your Toolbox.
  2. From the Toolbox, double-click the C1FlexReport icon to add the component to your project. Note that the component will appear below the form in the Component Tray.
  3. Click the C1FlexReport component's smart tag and select Edit Report from its Tasks menu.
    The C1FlexReportDesigner opens and the C1FlexReport Wizard is ready to guide you through the five easy steps discussed above.

Creating a Report Definition Using Code:

The following steps show how you can create a report definition using the FlexReportDesigner application or using code. You can even write your own report designer or ad-hoc report generator.

The example uses code to create a simple tabular report definition based on the C1NWind database. The code is commented and illustrates the most important elements of the C1FlexReport object model. Complete the following steps:

  1. First, add a button control, C1FlexReport component, and FlexViewer control to your form. Set the following properties:

    Button.Name = btnEmployees

    C1FlexReport.Name = c1FlexReport1 (default name in C#)

    C1FlexViewer.Name = c1FlexViewer1 (default name in C#)

  2. Initialize the control, named c1FlexReport1, using the Clear method to clear its contents and set the control font (this is the font that will be assigned to new fields):
    Private Sub RenderEmployees()
    
    C1FlexReport1.DataSource.RecordSourceType = RecordSourceType.Auto ' clear any existing fields   
    C1FlexReport1.Clear()
    
    ' set default font for all controls   
    C1FlexReport1.Font.Name = "Tahoma"
    C1FlexReport1.Font.Size = 8
    
    End Sub
    
    private void RenderEmployees()
    {
    c1FlexReport1.DataSource.RecordSourceType = RecordSourceType.Auto;
       // clear any existing fields  
       c1FlexReport1.Clear();
       // set default font for all controls
       c1FlexReport1.Font.Name = "Tahoma";
       c1FlexReport1.Font.Size = 8;
    }
    
  3. Next, set up the DataSource object to retrieve the data that you want from the C1NWind.mdb database. This is done using the ConnectionString and RecordSource properties:

    ' initialize DataSource   
    Dim ds As DataSource = C1FlexReport1.DataSource
    ds.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\...\ComponentOne Samples\Common\C1NWind.mdb;"
    ds.RecordSource = "Employees"
    
    //initialize DataSource
    DataSource ds = c1FlexReport1.DataSource;
    ds.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\...\ComponentOne Samples\Common\C1NWind.mdb;";
    ds.RecordSource = "Employees";
    
  4. Next, initialize the Layout object that defines how the report will be laid out on the page. In this case, render the report in Portrait mode and set its Width to 6.5 inches (8.5 page width minus one inch for margins on either side):

    'initialize Layout
    Dim l As Layout = C1FlexReport1.Layout
    l.Orientation = OrientationEnum.Portrait
    l.Width = 6.5 * 1440 ' 8.5 - margins, in twips
    
    //initialize Layout
    Layout l = c1FlexReport1.Layout;
    l.Orientation = OrientationEnum.Portrait;
    l.Width = 6.5 * 1440; // 8.5 - margins, in twips
    
  5. Now comes the interesting part. Every report has five basic sections: Detail, Report Header, Report Footer, Page Header, and Page Footer. Use the following code to set up the report header by setting a couple of properties and adding a title field to it:

    ' create a report header   
    Dim s As Section = C1FlexReport1.Sections(SectionTypeEnum.Header)
    s.Height = 1440
    s.Visible = True
    s.BackColor = Color.FromArgb(200, 200, 200)
    Dim textFld1 As New TextField()
    textFld1.Name = "FldTitle"
    textFld1.Text = "Employees Report"
    textFld1.Left = 0
    textFld1.Top = 0
    textFld1.Width = 8000
    textFld1.Height = 1440
    textFld1.Font.Size = 24
    textFld1.Font.Bold = True
    textFld1.ForeColor = Color.FromArgb(0, 0, 100)
    C1FlexReport1.Sections.Header.Fields.Add(textFld1)
    
    // create a report header          
    Section s = c1FlexReport1.Sections[SectionTypeEnum.Header];
    s.Height = 1440;
    s.Visible = true;
    s.BackColor = Color.FromArgb(200, 200, 200);
    TextField textFld1 = new TextField();
    textFld1.Name = "FldTitle";
    textFld1.Text = "Employees Report";
    textFld1.Left = 0;
    textFld1.Top = 0;
    textFld1.Width = 8000;
    textFld1.Height = 1440;
    textFld1.Font.Size = 24;
    textFld1.Font.Bold = true;
    textFld1.ForeColor = Color.FromArgb(0, 0, 100);
    c1FlexReport1.Sections.Header.Fields.Add(textFld1);
    

    The section object has a Fields collection. The collection's Add method creates a new field and assigns it to the Section. The parameters specify the new field's Name, Text, Left, Top, Width, and Height properties. By default, the field has the same font as the control. Since this is a title, it makes sense to change the font and make it larger. Note that the field should be tall enough to accommodate the font size, or nothing will appear in it.

  6. Next, set up the Page Footer Section. This section is more interesting because it contains expressions in the text fields. To evaluate the expressions in the text field, simply set the expression in the TextField.Text.Expression property. The expression in the text field is evaluated when the report is rendered. In C1Report, same is achieved by setting the field's Calculated property to True. To create a page footer, add the following code:

    ' create a page footer   
    s = C1FlexReport1.Sections(SectionTypeEnum.PageFooter)
    s.Height = 500
    s.Visible = True
    
    Dim textFld2 As New TextField()
    textFld2.Name = "FldFtrLeft"
    textFld2.Text.Expression = ""
    "Employees: Printed on "
    " & Now"
    textFld2.Left = 0
    textFld2.Top = 0
    textFld2.Width = 4000
    textFld2.Height = 300
    textFld2.Font.Size = 8
    textFld2.Font.Bold = False
    C1FlexReport1.Sections.PageFooter.Fields.Add(textFld2)
    
    Dim textFld3 As New TextField()
    textFld3.Name = "FldFtrRight"
    textFld3.Text.Expression = ""
    "Page "
    " + Page + "
    " of "
    " & Pages"
    textFld3.Left = 4000
    textFld3.Top = 0
    textFld3.Width = 4000
    textFld3.Height = 300
    textFld3.Align = FieldAlignEnum.RightTop
    textFld3.Width = C1FlexReport1.Layout.Width - textFld3.Left
    C1FlexReport1.Sections.PageFooter.Fields.Add(textFld3)
    
    
    'add a line before page footer
    Dim shpfld As New ShapeField()
    shpfld.Name = "FldLine"
    shpfld.ShapeType = ShapeType.Line
    shpfld.Left = 0
    shpfld.Top = 0
    shpfld.Width = C1FlexReport1.Layout.Width
    shpfld.Height = 20
    C1FlexReport1.Sections.PageFooter.Fields.Add(shpfld)
    
    // create a page footer    
    s = c1FlexReport1.Sections[SectionTypeEnum.PageFooter];
    s.Height = 500;
    s.Visible = true;
    
    TextField textFld2 = new TextField();
    textFld2.Name = "FldFtrLeft";
    textFld2.Text.Expression = @ ""
    "Employees: Printed on "
    " & Now";
    textFld2.Left = 0;
    textFld2.Top = 0;
    textFld2.Width = 4000;
    textFld2.Height = 300;
    textFld2.Font.Size = 8;
    textFld2.Font.Bold = false;
    c1FlexReport1.Sections.PageFooter.Fields.Add(textFld2);
    
    TextField textFld3 = new TextField();
    textFld3.Name = "FldFtrRight";
    textFld3.Text.Expression = @ ""
    "Page "
    " + Page + "
    " of "
    " & Pages";
    textFld3.Left = 4000;
    textFld3.Top = 0;
    textFld3.Width = 4000;
    textFld3.Height = 300;
    textFld3.Align = FieldAlignEnum.RightTop;
    textFld3.Width = c1FlexReport1.Layout.Width - textFld3.Left;
    c1FlexReport1.Sections.PageFooter.Fields.Add(textFld3);
    
    //add a line before page footer
    ShapeField shpfld = new ShapeField();
    shpfld.Name = "FldLine";
    shpfld.ShapeType = ShapeType.Line;
    shpfld.Left = 0;
    shpfld.Top = 0;
    shpfld.Width = c1FlexReport1.Layout.Width;
    shpfld.Height = 20;
    c1FlexReport1.Sections.PageFooter.Fields.Add(shpfld);
    

    The Page Footer section uses expressions with variables that are not intrinsic to VBScript, but are defined by C1FlexReport.Page and Pages are variables that contain the current page number and the total page count. The section also uses a field configured to look like a line.

  7. Next, set up the Page Header Section. This section gets rendered at the top of every page and will display the field labels. Using a Page Header section to display field labels is a common technique in tabular reports. The code is simple, but looks a bit messy because of all the field measurements. In a real application, these values would not be hard-wired into the program. To create a page header with field labels, add the following code:

    'create a page header with field labels   
    s = C1FlexReport1.Sections(SectionTypeEnum.PageHeader)
    s.Height = 500
    s.Visible = True
    C1FlexReport1.Font.Bold = True
    
    Dim textFld4 As New TextField()
    textFld4.Name = "LblID"
    textFld4.Text = "ID"
    textFld4.Left = 0
    textFld4.Top = 50
    textFld4.Width = 400
    textFld4.Height = 300
    textFld4.Align = FieldAlignEnum.RightTop
    C1FlexReport1.Sections.PageHeader.Fields.Add(textFld4)
    
    Dim textFld5 As New TextField()
    textFld5.Name = "LblFirstName"
    textFld5.Text = "First"
    textFld5.Left = 500
    textFld5.Top = 50
    textFld5.Width = 900
    textFld5.Height = 300
    C1FlexReport1.Sections.PageHeader.Fields.Add(textFld5)
    
    Dim textFld6 As New TextField()
    textFld6.Name = "LblLastName"
    textFld6.Text = "Last"
    textFld6.Left = 1500
    textFld6.Top = 50
    textFld6.Width = 900
    textFld6.Height = 300
    C1FlexReport1.Sections.PageHeader.Fields.Add(textFld6)
    
    Dim textFld7 As New TextField()
    textFld7.Name = "LblTitle"
    textFld7.Text = "Title"
    textFld7.Left = 2500
    textFld7.Top = 50
    textFld7.Width = 2400
    textFld7.Height = 300
    C1FlexReport1.Sections.PageHeader.Fields.Add(textFld7)
    
    Dim textFld8 As New TextField()
    textFld8.Name = "LblTitle"
    textFld8.Text = "Notes"
    textFld8.Left = 5000
    textFld8.Top = 50
    textFld8.Width = 8000
    textFld8.Height = 300
    C1FlexReport1.Sections.PageHeader.Fields.Add(textFld8)
    C1FlexReport1.Font.Bold = False
    
    Dim shpfld2 As New ShapeField()
    shpfld2.Name = "FldLine"
    shpfld2.ShapeType = ShapeType.Line
    shpfld2.Left = 0
    shpfld2.Top = 400
    shpfld2.Width = C1FlexReport1.Layout.Width
    shpfld2.Height = 20
    C1FlexReport1.Sections.PageHeader.Fields.Add(shpfld2)
    
    //create a page header with field labels   
    s = c1FlexReport1.Sections[SectionTypeEnum.PageHeader];
    s.Height = 500;
    s.Visible = true;
    c1FlexReport1.Font.Bold = true;
    
    TextField textFld4 = new TextField();
    textFld4.Name = "LblID";
    textFld4.Text = "ID";
    textFld4.Left = 0;
    textFld4.Top = 50;
    textFld4.Width = 400;
    textFld4.Height = 300;
    textFld4.Align = FieldAlignEnum.RightTop;
    c1FlexReport1.Sections.PageHeader.Fields.Add(textFld4);
    
    TextField textFld5 = new TextField();
    textFld5.Name = "LblFirstName";
    textFld5.Text = "First";
    textFld5.Left = 500;
    textFld5.Top = 50;
    textFld5.Width = 900;
    textFld5.Height = 300;
    c1FlexReport1.Sections.PageHeader.Fields.Add(textFld5);
    
    TextField textFld6 = new TextField();
    textFld6.Name = "LblLastName";
    textFld6.Text = "Last";
    textFld6.Left = 1500;
    textFld6.Top = 50;
    textFld6.Width = 900;
    textFld6.Height = 300;
    c1FlexReport1.Sections.PageHeader.Fields.Add(textFld6);
    
    TextField textFld7 = new TextField();
    textFld7.Name = "LblTitle";
    textFld7.Text = "Title";
    textFld7.Left = 2500;
    textFld7.Top = 50;
    textFld7.Width = 2400;
    textFld7.Height = 300;
    c1FlexReport1.Sections.PageHeader.Fields.Add(textFld7);
    
    TextField textFld8 = new TextField();
    textFld8.Name = "LblTitle";
    textFld8.Text = "Notes";
    textFld8.Left = 5000;
    textFld8.Top = 50;
    textFld8.Width = 8000;
    textFld8.Height = 300;
    c1FlexReport1.Sections.PageHeader.Fields.Add(textFld8);
    c1FlexReport1.Font.Bold = false;
    
    ShapeField shpfld2 = new ShapeField();
    shpfld2.Name = "FldLine";
    shpfld2.ShapeType = ShapeType.Line;
    shpfld2.Left = 0;
    shpfld2.Top = 400;
    shpfld2.Width = c1FlexReport1.Layout.Width;
    shpfld2.Height = 20;
    c1FlexReport1.Sections.PageHeader.Fields.Add(shpfld2);
    

    This code illustrates a powerful technique for handling fonts. Since every field inherits the control font when it is created, set the control's Font.Bold property to True before creating the fields, and set it back to False afterwards. As a result, all controls in the Page Header section have a bold font.

  8. To finalize the report, add the Detail Section. This is the section that shows the actual data. It contains expressions in the text fields below each label in the Page Header Section. To create the Detail section, add the following code:

    ' create the Detail section   
    s = C1FlexReport1.Sections(SectionTypeEnum.Detail)
    s.Height = 330
    s.Visible = True
    
    Dim textField As New TextField()
    textField.Name = "FldID"
    textField.Text.Expression = "EmployeeID"
    textField.Left = 0
    textField.Top = 0
    textField.Width = 400
    textField.Height = 300
    C1FlexReport1.Sections.Detail.Fields.Add(textField)
    
    Dim textField1 As New TextField()
    textField1.Name = "FldFirstName"
    
    textField1.Text.Expression = "FirstName"
    textField1.Left = 500
    textField1.Top = 0
    textField1.Width = 900
    textField1.Height = 300
    C1FlexReport1.Sections.Detail.Fields.Add(textField1)
    
    Dim textField2 As New TextField()
    textField2.Name = "FldLastName"
    textField2.Text.Expression = "LastName"
    textField2.Left = 1500
    textField2.Top = 0
    textField2.Width = 900
    textField2.Height = 300
    C1FlexReport1.Sections.Detail.Fields.Add(textField2)
    
    Dim textField3 As New TextField()
    textField3.Name = "FldTitle"
    textField3.Text.Expression = "Title"
    textField3.Left = 2500
    textField3.Top = 0
    textField3.Width = 2400
    textField3.Height = 300
    C1FlexReport1.Sections.Detail.Fields.Add(textField3)
    
    Dim textField4 As New TextField()
    textField4.Name = "FldNotes"
    textField4.Text.Expression = "Notes"
    textField4.Left = 5000
    textField4.Top = 0
    textField4.Width = 8000
    textField4.Height = 300
    C1FlexReport1.Sections.Detail.Fields.Add(textField4)
    
    textField4.Width = C1FlexReport1.Layout.Width - textField4.Left
    textField4.AutoHeight = AutoSizeBehavior.CanGrow
    textField4.Font.Size = 6
    textField4.Align = FieldAlignEnum.JustTop
    
      'add a line after each field in detail section
    Dim shpfld3 As New ShapeField()
    shpfld3.Name = "FldLine"
    shpfld3.ShapeType = ShapeType.Line
    shpfld3.Left = 0
    shpfld3.Top = 310
    shpfld3.Width = C1FlexReport1.Layout.Width
    shpfld3.Height = 20
    C1FlexReport1.Sections.Detail.Fields.Add(shpfld3)
    
    // create the Detail section   
    s = c1FlexReport1.Sections[SectionTypeEnum.Detail];
    s.Height = 330;
    s.Visible = true;
    
    TextField textField = new TextField();
    textField.Name = "FldID";
    textField.Text.Expression = "EmployeeID";
    textField.Left = 0;
    textField.Top = 0;
    textField.Width = 400;
    textField.Height = 300;
    c1FlexReport1.Sections.Detail.Fields.Add(textField);
    
    TextField textField1 = new TextField();
    textField1.Name = "FldFirstName";
    
    textField1.Text.Expression = "FirstName";
    textField1.Left = 500;
    textField1.Top = 0;
    textField1.Width = 900;
    textField1.Height = 300;
    c1FlexReport1.Sections.Detail.Fields.Add(textField1);
    
    TextField textField2 = new TextField();
    textField2.Name = "FldLastName";
    textField2.Text.Expression = "LastName";
    textField2.Left = 1500;
    textField2.Top = 0;
    textField2.Width = 900;
    textField2.Height = 300;
    c1FlexReport1.Sections.Detail.Fields.Add(textField2);
    
    TextField textField3 = new TextField();
    textField3.Name = "FldTitle";
    textField3.Text.Expression = "Title";
    textField3.Left = 2500;
    textField3.Top = 0;
    textField3.Width = 2400;
    textField3.Height = 300;
    c1FlexReport1.Sections.Detail.Fields.Add(textField3);
    
    TextField textField4 = new TextField();
    textField4.Name = "FldNotes";
    textField4.Text.Expression = "Notes";
    textField4.Left = 5000;
    textField4.Top = 0;
    textField4.Width = 8000;
    textField4.Height = 300;
    c1FlexReport1.Sections.Detail.Fields.Add(textField4);
    
    textField4.Width = c1FlexReport1.Layout.Width - textField4.Left;
    textField4.AutoHeight = AutoSizeBehavior.CanGrow;
    textField4.Font.Size = 6;
    textField4.Align = FieldAlignEnum.JustTop;
    
    //add a line after each field in detail section
    ShapeField shpfld3 = new ShapeField();
    shpfld3.Name = "FldLine";
    shpfld3.ShapeType = ShapeType.Line;
    shpfld3.Left = 0;
    shpfld3.Top = 310;
    shpfld3.Width = c1FlexReport1.Layout.Width;
    shpfld3.Height = 20;
    c1FlexReport1.Sections.Detail.Fields.Add(shpfld3);
    

    Note that all text fields contain expressions and each text field corresponds to the names of fields in the source record source. Setting the expressions in the TextField.Text.Expression property ensures that the Text property is interpreted as a database field name, as opposed to being rendered literally. It is important to adopt a naming convention for report fields that makes them unique, different from recordset field names. If you had two fields named "LastName", an expression such as "Left(LastName,1)" would be ambiguous. This example has adopted the convention of beginning all report field names with "Fld".

    Note that the "FldNotes" field has its AutoHeight property set to CanGrow, and a smaller font than the others. This was done to make sure that the "Notes" field in the database, which contains a lot of text, will appear in the report. Rather than make the field very tall and waste space, setting the AutoHeight property to CanGrow tells the control to expand the field as needed to fit its contents; it also sets the containing section's AutoHeight property to True, so the field doesn't spill off the Section.

  9. The report definition is done. To render the report into the FlexViewer control, double-click the Employees button to add an event handler for the btnEmployees_Click event. The Code Editor will open with the insertion point placed within the event handler. Enter the following code:

    RenderEmployees()
    C1FlexViewer1.DocumentSource = C1FlexReport1
    
    RenderEmployees();
    c1FlexViewer1.DocumentSource = c1FlexReport1;
    

    Here's what the basic report looks like:
    Create Report Definition in FlexReport