Wednesday, August 31, 2005

Barcode in Reporting Services 2005 Local Mode

Some of our Barcode Professional for Reporting Services customers has asked about how to use it in Reporting Services 2005 Local Mode. Local mode in SSRS 2005 is a great feature which allows you to use all SSRS 2005 power and flexibility with your Windows as well as ASP.NET applications without a SQL Server 2005 license (it’ll be required if you use reports in Server Mode). In local mode you use the new ReportViewer controls included in VS.NET 2005 (Standard or grater) to render RDLC files. RDL (Report Definition Language) files are XML-based and they describe all about the report they represent. RDLC are the same RDL files but they only can be used in Local Mode.
In local mode you must tell to the ReportViewer control what RDLC file you want to show and the data source for it.
SSRS is so extensible that it allows you to develop .NET assemblies and then use them into your reports. Our barcode component is in fact a .NET assembly that renders barcode images.
If you use SSRS in Server mode, all .NET custom assemblies that use your report have to be registered in the report server policy configuration file (rssrvpolicy.config) but what happen if you use them in Local Mode?
Well, it’s a good question… In a first approximation to find a solution to this issue I reach a page that in theory explain how to “Configure the ReportViewer Control for Local Processing” but it does not mention anything related to custom assemblies. If you follow all the topics related to this last one you won’t find anything as well. At this point I was very tired but suddenly I saw the light :-)
I realize some links on the top of every page and after a pair of clicks I reach the LocalReport class. This class exposes a method called AddTrustedCodeModuleInCurrentAppDomain that solves the issue.

So if you want to use our Barcode assembly (or any custom .NET assembly) with SSRS 2005 in Local Mode in a Windows Forms app, you’ll have to call that method in the Load event of the form that holds the ReportViewer control. Sample code:

Version=1.0.5000.0,Culture=neutral, PublicKeyToken=null

Version=1.0.5000.0,Culture=neutral, PublicKeyToken=null

Currently, we’re updating our Barcode component for RS to be fully compliance with the new SSRS 2005 Report Items infrastructure but meanwhile you can use our current version in SSRS 2000 or 2005, too.


Post a Comment

<< Home