Reports for WinForms | ComponentOne
Working with C1PrintDocument / C1Report Definitions
In This Topic
    C1Report Definitions
    In This Topic

    C1PrintDocument has the ability to import and generate C1Report definitions.

    To import a C1Report into a C1PrintDocument, use the ImportC1Report method. For example, the following code can be used to import and preview the Alphabetical List of Products report included in the ReportBrowser sample shipped with Reports for WinForms:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim doc As C1PrintDocument = New C1PrintDocument()
    doc.ImportC1Report("NWind.xml", "Alphabetical List of Products")
    Dim pdlg As C1PrintPreviewDialog = New C1PrintPreviewDialog()
    pdlg.Document = doc
    pdlg.ShowDialog()
    

    To write code in C#

    C#
    Copy Code
    C1PrintDocument doc = new C1PrintDocument();
    doc.ImportC1Report("NWind.xml", "Alphabetical List of Products");
    C1PrintPreviewDialog pdlg = new C1PrintPreviewDialog();
    pdlg.Document = doc;
    pdlg.ShowDialog();
    

    After a C1Report has been imported into C1PrintDocument, the document has the following structure:

    For a report without grouping:

    A copy of the PageHeader is also assigned to the PageHeader.LayoutChangeAfter.PageLayout.PageHeader. This complex structure is needed because in C1Report, the first page header is printer after the report header.

    For a report with grouping:

    For each group, a RenderArea is created, and the following object tree is placed between the PageHeader and Footer (for 2 groups):

    See Also