.NET Programming Guide
i-net Clear Reports can be accessed by .NET applications using a process bridge. The bridge is a .NET library providing API access to the reporting engine. A Java process with the actual server is spawned during the startup of the bridge. The .NET bridge communicates with the server using inter process communication. More details can be found in the documentation of the SDK.
.NET Viewer Example
The .NET Viewer is an example of how to use the .NET integrated control to show your reports. The source code is included, which means you can customize the Viewer to your needs - e.g. including them in your .NET application, or changing the User Interface to make it better fit into your Corporate Design. The project was created with Visual Studio 2010 and is optimized for use with .NET 3.5 and higher.
Note: The .NET Viewer can be used with both the Java and the .NET Version of the i-net Clear Reports server.
Where do I find the example files?
The .NET Viewer example files are in the samples folder of the i-net Clear Reports server installation. Note that during setup you must make sure to include the samples. Then all project files will be included.
You can find the .NET Viewer sample code in the subfolder: \documentation\developer\samples\viewer_.net
of the i-net Clear Reports installation folder.
Introduction
The .NET Viewer enables you to display an i-net Clear Reports report within a .NET environment. The report source is the i-net Clear Reports report server. It is an implemented UserControl based on Windows Forms to be used within the Visual Studio Editor.
Implemented features
-
Drilldown
-
Show or Hide Group tree
-
Subreports
-
Multiple Reports allowed
-
Manually set the title of a ReportView (only via code)
-
Access reports from an i-net Clear Reports Server
-
Page navigation
-
Refresh
-
Zoom
URL Parameter
The following URL parameters are implemented for the .NET Viewer. By setting these parameters the default settings from the client and server will be overridden. Some of these properties have an equivalent property in the class ReportView.
For more information see URL Parameter documentation
Implemented URL Parameter
-
hasgrouptree
-
hasrefreshbutton
-
hastoolbar
-
haszoomcontrol
Ignored URL Parameters
Note that the following URL parameters are ignored by the viewer as they are used by the server for different report formats or pages.
-
init
-
page
Simple Example
Example for using the ReportViewer to show a report via server access. First the control inet.Viewer.WinForms.ReportViewer has to be added to a Form or Panel in Visual Studio.
string url = "http://localhost:9000/?report=file:C:/Reports/Testreport.rpt"; // generate the ReportData URLRenderData urlData = new URLRenderData(url); // create the view ReportView view = new ReportView(data); // add view to the ReportViewer this.reportViewer1.AddReportView(view);
For more details have a look at chapter Entry point
Visual Studio Toolbox
To use the ReportViewer out of the Toolbox you need to do the following steps:
-
Compile the ReportViewer project
-
Add the compiled dll to your project
-
Follow this link Add items to toolbox to add the compiled dll
Internationalization
The locale is depending on the locale of the client computer. The implementation is using the standard .NET localization which is using resource files. The method ReportViewer.SetLabels() has to be invoked to change the text and tooltips if the locale was changed. Currently the tooltips of the action buttons and the error messages are localized.
The client locale is transmitted to the server to show the report in a suitable language (if the report supports multiple languages). If the locale is set in the URL parameters, than this will override the system locale. At the moment English and German are supported.
Use the following structure to create your own language file if you need to:
-
strings.resx (default locale which is English)
-
strings.de.resx (German)
Packages
This chapter gives a short overview and explanation of the class structure and highlights some of the main classes.
inet.Viewer.Data
Implementation of all the classes that get the data from the server to pass it to the viewer.
inet.Viewer.WinForms
Implementation of the .NET Viewer controls on the basis of Windows Forms.
inet.Viewer.common
Common classes.
inet.Viewer.interfaces
Contains all the interfaces that are used for the .NETViewer
Important Classes
Entry point
-
inet.Viewer.WindowsForms.ReportViewerExample.cs:
An Example on how to use the .NET Viewer. The entry point for looking into the source code. Shows how to invoke a report with the server.
Main classes
-
inet.Viewer.WindowsForms.ReportViewer.cs
: The main Control of the ReportViewer. Add ReportViews to this class. A UserControl that also can be used via the Visual Editor. -
inet.Viewer.Data.UrlRenderData.cs
The implementation of the IRenderData interface for the access of the data for a report from the server -
inet.Viewer.WindowsForms.ReportView.cs
To create an instance of one report to be able to add it to the ReportViewer