Reports for WinForms | ComponentOne
In This Topic
    Loading a Report Definition from a File
    In This Topic

    You can use the C1ReportDesigner to create report definition files (XML files that may contain one or more report definitions). For details on how to use the C1ReportDesigner, see the Working with C1ReportDesigner section of the documentation.

    To load a report definition from a file at design time:

    To load a report definition from a file at design time, complete one of the following tasks:

    Using the Select a report dialog box to select the report you want, complete the following tasks:

    1. Click the ellipsis button. The Open dialog box appears and you can select the XML file.
    2. The available report definitions are listed in the Report drop-down box. Select the report definition to load.
    3. Click Load and OK to close the dialog box.

    This is what the report selector dialog box looks like:


    To load a report definition from a file using code:

    To load a report definition from a file, use the Load method. It takes as parameters the name of the report definition file and the name of the report you want to load. If you want to list the reports contained in a report definition file, use the GetReportInfo method. It returns a list of the reports in the file.

    For example:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Get list of reports in a report definition file
    Dim reports As String() = c1r.GetReportInfo(reportFile)
     
    ' Load first report into C1Report component
    c1r.Load(reportFile, reports(0))
    

    To write code in C#

    C#
    Copy Code
    // Get list of reports in a report definition file
    string[] reports = c1r.GetReportInfo(reportFile);
     
    // Load first report into C1Report component
    c1r.Load(reportFile, reports[0]);