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

    C1Report has a ReportDefinition property that allows you to get or set the entire report definition as a string. This is a convenient way to store and retrieve report definitions in databases or in data structures within your application.

    The ReportDefinition string contains the exact same XML that would be stored in the report definition file, for example:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Load report definition into C1Report component
    c1r.Load(reportFile, reportName)
     
    ' Copy report definition to the clipboard
    Dim repDef As String = c1r.ReportDefinition
    Clipboard.SetDataObject(repDef)
     
    ' Copy report definition to c1r2 component
    c1r2.ReportDefinition = repDef
    

    To write code in C#

    C#
    Copy Code
    // Load report definition into C1Report component
    c1r.Load(reportFile, reportName);
     
    // Copy report definition to the clipboard
    string repDef = c1r.ReportDefinition;
    Clipboard.SetDataObject(repDef);
     
    // Copy report definition to c1r2 component
    c1r2.ReportDefinition = repDef;