简体   繁体   中英

Showing rtf data in SQL SERVER Reporting Services (SSRS)

I am trying to show rtf Data in SQL SERVER Reporting Services (SSRS). I have Visual Studio 2010 and ReportViewer Version 10.0.0

The rtf data is stored in the dataset which I am binding to the SSRS report.

I have added following reference to Report References System.Windows.Forms In Textbox Expression in SSRS-Report,

=Code.ConvertRtfToText(Fields!colInfo.Value)

Following code I have put in Report Code properties

Public Shared Function ConvertRtfToText(ByVal input As String) As String 
Dim returnValue As String = String.Empty
Dim converter As New System.Windows.Forms.RichTextBox()
converter.Rtf = input.Trim 
returnValue = converter.Text 
Return returnValue 
End Function

The Output I get is

{\rtf1\ansi\ansicpg1252\uc1 aaa}

That function looks like it should convert rtf to plain text fine. It's not possible your input data was accidentally "double converted" to rtf, ie the input to your function was

{\rtf1\ansi\ansicpg1252\uc1 \{\\rtf1\\ansi\\ansicpg1252\\uc1 aaa\}} 

is it? If not please provide the input to the function for comparison.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM