ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Getting Started with Reports for WinForms > Generating Reports (C1Report vs. C1PrintDocument)

Generating Reports (C1Report vs. C1PrintDocument)

The Reports for WinForms assembly now provides two distinctly different methods for generating reports:

      Using the C1PrintDocument.ImportC1Report method.

      Using the C1Report component.

While many existing reports can be correctly generated using either method, there are some important differences between the two. Some of the key differences are listed below.

Data binding:

The ImportC1Report method creates a data-bound C1PrintDocument component. The C1PrintDocument component is then generated with data being fetched. The resulting document can be refreshed with data refreshing. When the C1Report component is used, the generated document already contains embedded data fetched during document generation, and the resulting document is not data-bound (but of course, the report can be rendered again, refreshing the data).

Document structure:

When a report is imported in the resulting C1PrintDocument structure, all fields are represented by RenderField, and all sections by RenderSection objects. If a report definition contains groups, each group is represented by a RenderArea object, with nested RenderSection objects for the group header and footer, and a RenderArea for the nested group.

When the C1Report component is used, each report section is rendered into a RenderArea object. The fields are rendered as follows:

      If LineSlant is specified, a RenderLine is generated;

      If image or barcode is specified, a RenderImage is generated;

      If RTF is True, a RenderRichText is generated;

      In all other cases, a RenderText is generated.

Page size:

When a report with unset (or set to zeros) CustomWidth and CustomHeight properties is imported on a system without a printer, the default page size depends on the locale, as always in C1PrintDocument (for example, for US and Canada, the page size will be Letter, for Russia A4, and so on).

When such report is loaded into the C1Report component, the page size is always set to Letter (8.5 x 11 inches), which is the behavior of C1.Win.C1Report.C1Report.

Default printer:

On a system with one or more printers installed, the default page size for an imported report is determined using the same logic as for a regular C1PrintDocument (in particular, the MeasurementPrinterName property is used to determine which printer to use). The main reason for this behavior is to avoid long wait times on systems with default network printers. When the C1Report component is used, the default page size is determined by the system default printer.

Limitations of import:

The import method has some inherent limitations which are not likely to ever be lifted. These limitations include:

      When import is used, the C1Report object model is not available and report events are not invoked. Hence the main limitation of import: reports depending on C#/VB event handlers cannot be rendered correctly when imported.

      Scripting limitations:

C1PrintDocument object:
- The Font property is read-only.

Field object:
- Section, Font, and Subreport properties are read-only;
- LineSpacing, SubreportHasData, and LinkValue properties are not supported; if the LinkTarget property contains an expression, it is not evaluated and will be inserted into the generated report as-is.

Layout object:
- The ColumnLayout property is not supported, columns always go top to bottom and left to right.
- LabelSpacingX, LabelSpacingY, and OverlayReplacements are not supported.
- ForcePageBreak cannot be used in the OnPrint handler.

      The dialog box is not shown for parameterized reports. Instead, default values depending on the parameter type are used (0 for numbers, empty string for strings, the current date for dates and so on).

      PageHeader/PageFooter cannot reference database fields.

      In multi-column reports, the report header is printed only above the first column (in C1Report, the header spans all columns).

      Left to right orientation for columns is not supported – columns are always oriented from top to bottom.

      In C1Report, a Field containing an image, with CanGrow set to True and PictureScale set to Clip, has the width equal to that of the image. When imported, the width of such a field is scaled proportionally to the width of the image.


Deciding on Report Generation Method


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