Reports for WinForms | ComponentOne
In This Topic
    Getting Started with Reports for WinForms
    In This Topic

    The current release of Reports for WinForms includes a new component, C1.C1Report.C1Report. This component provides a complete compatible replacement for C1.Win.C1Report.C1Report found in previous releases. The only difference, from the user code point of view, is the namespace change (C1.C1Report instead of C1.Win.C1Report). The C1.C1Report namespace also provides all other familiar public C1Report classes such as Field, Section, and so on. Again, the only expected difference affecting the user is the namespace change.

    Internally, the new C1Report works differently from the old version. Whereas the old C1Report engine in the usual (preview/print) scenario generated metafile page images, the new C1Report builds a C1PrintDocument representing the report. That document is accessible via the new public read-only property on C1Report: C1PrintDocument C1Report.C1Document {get;}.

    The document can then be used in any of the usual ways; for example, it can be exported to one of the formats supported by C1PrintDocument.

    Export filters:

    Along with other public members exposed by the old version, the new C1Report provides the familiar WinForms C1Reports export filters, so the following code is still completely valid:

    report.Load(...);
    report.RenderToFile("MyReport.rtf",C1.C1Report.FileFormatEnum.RTF);

    It is important to note that the file produced by the code above (in our example, an RTF file) will differ from the file produced by exporting the C1PrintDocument exposed by the report:

    report.Load(...);
    report.C1Document.Export("MyReport.rtf");

    Usually, the a RenderToFile would yield better results, unless the target format is a fixed layout format (such as PDF), in which case the results should be identical.

    Note also that the RenderToFile method does not support the new XPS format, the only way to generate an XPS file is to export the C1PrintDocument exposed by C1Report.

    See Also