VSReport 8.0 users will have no trouble using C1Report. Although C1Report was completely rewritten in C# to take advantage of the latest .NET technologies, the object model is virtually identical to the one in VSReport 8.0. C1Report uses the same report definition files, and implements all the features you are used to, including subreports, export options including HTML/DHTML/PDF export, and much more.
C1Report also includes the same powerful Report Designer that ships with VSView Reporting Edition, so creating and customizing your reports is as easy as ever.
The main difference between VSReport and C1Report is how reports are rendered into preview controls: VSReport uses the VSPrinter control to provide report previewing. For example, the following line of code would render the report in vsreport1 into the vsprinter1 control:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
VSReport1.Render(vsprinter1) |
To write code in C#
C# |
Copy Code
|
---|---|
vsreport1.Render(vsprinter1); |
C1Report exposes a PrintDocument object instead. This object can be used to print the report, or it can be attached to a preview control such as the C1PrintPreview or the Microsoft PrintPreviewControl. For example, the following line of code would render the report in C1Report1 into the C1PrintPreview1 control:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1PrintPreview1.Document = c1r |
To write code in C#
C# |
Copy Code
|
---|---|
c1printPreview1.Document = c1r; |
C1Report event names are also different from VSReport. The events were renamed because VSReport has script-handler properties with the same name as the events. In .NET, events and properties must have different names.
Aside from these differences, the controls have virtually identical object models. Both implement the RenderToFile method, which renders reports to HTML, PDF and other types of file, and both expose collections of Groups, Sections, and Fields.