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

    The C1.C1Report.C1Report component in Reports for WPF provides a complete compatible replacement for the C1.Win.C1Report.C1Report component included in previous versions of Reports for .NET. 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 C1Report’s export filters, so the following code is still completely valid:

    C#
    Copy Code
    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:

    C#
    Copy Code
    report.Load(...);
    report.C1Document.Export("MyReport.rtf");
    

    Usually, the C1Report.RenderToFile method would yield better results, unless the target format is a fixed layout format (such as PDF), in which case the results should be identical. Also note that the C1Report.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.

    From 2015v2 onwards, please add C1.Win.4 and C1.Win.Barcode.4 dlls to the projects referencing C1.WPF.C1Report.CustomFields.4 dll.
    See Also