ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1PrintDocument > C1Report Definitions

C1Report Definitions

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:

      Visual Basic

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()

      C#

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:

      The page footer is represented by a RenderSection object and is assigned to the document's PageLayouts.Default.PageFooter.

      For each section of the report, a RenderSection object is created and added to the Body of the document in the following order:

      Header (the report header, SectionTypeEnum.Header)

      PageHeader (the page header, SectionTypeEnum.PageHeader)

      Detail (the data section, SectionTypeEnum.Detail)

      Footer (the report footer, SectionTypeEnum.Footer)

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):

      RenderArea representing the top level group

      RenderSection representing GroupHeader1

      RenderArea representing the nested group

      RenderSection representing GroupHeader2

      Detail

      RenderSection representing GroupFooter2

      RenderSection representing GroupFooter1


C1Report Import Limitations

Working with Printer Drivers


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.