Custom Report Item Sample
PolygonsCRI is a simple custom report item sample. This sample uses the System.Component classes from the Microsoft .NET Framework and classes from the Microsoft.ReportDesigner and Microsoft.ReportingServices namespaces to implement a custom report item run-time component and design-time component that can be used in Report Builder.
The SQL Server samples are not installed automatically during setup. For instructions about how to install the samples, see Installing Samples.
|Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.|
You should be familiar with Visual Studio and Microsoft Visual C#, and your system must meet the following requirements to use the PolygonsCRI sample:
Microsoft SQL Server 2005 with Reporting Services
Microsoft SQL Server Business Intelligence Development Studio.
Microsoft Visual Studio 2005.
Microsoft .NET Framework version 2.0.
Reporting Services samples. A report server that you have permission to access on your network.
Note: Business Intelligence (BI) Development Studio and Visual Studio 2005 are not supported on Itanium-based computers. However, support is available for x64-based computers. If the SQL Server 2005 sample databases have been deployed on an Itanium-based computer, use BI Development Studio or Visual Studio on either an x86-based or x64-based computer to modify and run the samples.
If you have not already created a strong name key file, generate the key file using the following instructions.
- Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
-- or --
Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
- Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.
Note: To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.
- At the command prompt, run the following command to generate the key file:
sn -k SampleKey.snk
Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
Edit rsreportserver.config to register the PolygonsCRI:
Insert the following lines before </Extensions>:
<ReportItems> <ReportItem Name="Polygons" Type="Microsoft.Samples.ReportingServices.PolygonsCCustomReportItem,PolygonsCRI"/> </ReportItems>
- Insert the following lines before </Extensions>:
Edit the rssrvpolicy.config file to add a code group for the custom report item:
Add the following lines:
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Description="This code group grants PolygonsCRI.dll FullTrust permission. "> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\PolygonsCRI.dll" /> </CodeGroup>
- Add the following lines:
Edit the rsreportdesigner.config file to register the run-time component, the design-time component, and the item type converter:
Add the following lines before </Extensions>:
<ReportItems> <ReportItem Name="Polygons" Type="Microsoft.Samples.ReportingServices.PolygonsCCustomReportItem,PolygonsCRI"/> </ReportItems> <ReportItemDesigner> <ReportItem Name="Polygons" Type=" Microsoft.Samples.ReportingServices.PolygonsDesigner, PolygonsDesigner" /> </ReportItemDesigner> <ReportItemConverter> <Converter Source="Chart" Target="Polygons" Type=" Microsoft.Samples.ReportingServices.PolygonsConverter, PolygonsDesigner" /> </ReportItemConverter>
- Add the following lines before </Extensions>:
Copy the PolygonsCRI.dll file from the \PolygonCRI\Bin\Debug directory where you copied the sample project to the Visual Studio private assemblies directory (by default, \Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies).
Copy the PolygonsCRI.dll file from the \PolygonCRI \Bin\Debug directory where you copied the sample project to the Microsoft SQL Server Reporting Services bin directory (by default, \Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\Bin).
Copy the PolygonsDesigner.dll file from the \PolygonDesigner\Bin\Debug directory to the Visual Studio private assemblies directory (by default, \Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies).
This section contains a quick walkthrough that shows how to reference the Polygon custom report item in Visual Studio and then test it.
To edit a report using the PolygonDesigner custom control in Visual Studio, you can do any of the following:
Set the properties of the polygons control in the property browser.
Edit properties via the control's context menu.
Drag fields onto the drop areas of the control from the fields list.
Select the chart and in the context menu choose Convert to Polygons.