Displaying RTF Objects in SSRS 2008
We are using Microsoft SQL Server Reporting Services Version 10.0.1600.22 andMicrosoft Visual StudioVersion 9.0.21022.8I would like to be able to display .rtf in reports created in VS when we aredesigning/testing them and when they are deployed to SSRS.Can this be done?Thanks,Chris
August 25th, 2009 10:51pm
Hi Chris,
From your description, you want to convert RTF to TXT in SQL Server Reporting Services.
In SQL Server Reporting Services, we can use the custom code function to convert the RTF to TXT. In the custom code function, use the window RichTextBox control to read the RTF, and then return the TXT.
Here are the detailed steps to convert RTF to TXT in SQL Server Reporting Services:
1. Use the following custom code in the Report. The custom code includes a function named ConvertRtfToText. This function requires a parameter that is the RTF.
Public Shared Function ConvertRtfToText(ByVal input As String) As String
Dim returnValue As String = String.Empty
Using converter As New System.Windows.Forms.RichTextBox()
converter.Rtf = input.Trim
returnValue = converter.Text
End Using
Return returnValue
End Function
2. To use the above custom code function, we need to add a reference that refers to the instance System.Windows.Forms.
Please add the reference System.Windows.Forms in the Reference tab of Report properties dialog.
3. Setup a domain account for Execution Account using the Reporting Services Configuration Manager.
Executing the above custom code is an unattended report processing.
Unattended report processing refers to any report execution process that is triggered by an event (either a schedule-driven event or data refresh event) rather than a user request. The report server uses the unattended report processing account to log on to the computer that hosts the external data source. This account is necessary because the credentials of the Report Server service account are never used to connect to other computers.
Reporting Services provides a special account named Execution Account that is used for unattended report processing and for sending connection requests across the network. To solve the issue, you could setup a domain account for Execution Account.
4. For security reasons, the default permission of report expressions is Execution which is defined in the SQL Server Reporting Service CONFIG file rssrvpolicy.config. If we use a custom function in the expression, and the custom function uses code like this Using converter As New System.Windows.Forms.RichTextBox() , the expression will require more permissions in addition to Execution.
To provide proper execution permission, we can change the permission set of the following code groups to be FullTrust:
<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="Nothing">
<IMembershipCondition class="AllMembershipCondition" version="1" />
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Report_Expressions_Default_Permissions" Description="This code group grants default permissions for code in report expressions and Code element. ">
<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="FullTrust" Description="This code group grants MyComputer code Execution permission. ">
<IMembershipCondition class="ZoneMembershipCondition" version="1" Zone="MyComputer" />
After finishing the following steps, we can convert the RTF to TXT in the SQL Server Reporting Services.
For more information about code access security, please see:
Understanding Code Access Security in Reporting Services: http://msdn.microsoft.com/en-us/library/ms155108.aspx
Execution Account (Reporting Services Configuration): http://msdn.microsoft.com/en-us/library/ms181156(SQL.90).aspx
If there is anything unclear, please feel free to ask.
Thanks,
Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
August 27th, 2009 5:12am
We are able to get this to work on our Windows 7 development machines, but getting the #Error when running in on a Window 2008 Server. Is there something else we need to change?
I originally created my own dll for this and have it working on a Windows 2003 Server. We are in the process of moving all of our reports to Windows Server 2008 R2.
Thanks
November 29th, 2010 11:11am
I ended up contacting Microsoft because this should have worked. When I gave them a sample application in worked in their environment. It turned out that they had a hotfix installed for Reporting Services that I did not. After I installed the hotfix, everything
worked.
build 10.50.1720 - applied CU2 for SSRS 2008 R2 RTM (http://support.microsoft.com/kb/2072493).
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2010 10:06am