Though SQL Server Reporting Services (SSRS) only displays plain text, it's possible to convert the rich text (RTF) fields in the WRM database into plain text, which then allows you to include those fields in your report. This is done by adding a custom code to the report, then adding an expression for each RTF field you wish to display as plain text.
To convert RTF to plain text in a report:
- Open the report in SSRS.
- Right-click the blue space on the report, then select Report Properties.
- Click Code in the left pane.
- Enter the following code in the text box:
Public Shared Function ConvertRtfToText(ByVal input As String) As String
Dim returnValue As String = String.Empty
try
Using converter As New System.Windows.Forms.RichTextBox()
converter.Rtf = input.Trim
returnValue = converter.Text
End Using
Catch
returnValue =input
End Try
Return returnValue
End Function
- Click References in the left pane.
- Click Add below Add or remove assemblies.
- Enter the following code in the text box:
System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- Click OK.
- Repeat steps 2-8 above for each report that will need RTF fields converted to plain text.
- Add the field you wish to convert from RTF to plain text to the appropriate report.
- Right-click the field, then click Expression.
- Add the following expression (replacing FieldName with the name of your field):
=Code.ConvertRtfToText(Fields!FieldName.Value)
- Repeat steps 10-12 above for each field you wish to convert.