Monday, March 12, 2012

Removing Rich Text formatting from a field

I have a field where the data is stored with RTF. I know SQL Reporting Services cannot display it properly. Is there way to remove the RTF formatting codes through a function to just pull out the text and displya it in the text box?

I had a similiar problem and found this link helpful:

http://www.4guysfromrolla.com/webtech/042501-1.shtml

I just took the function provided in the above link and placed it in the Code section of my report. It may need some tweaking depending on your specific needs but hopefully it will help.

|||

place this code in your Code section:

function StripRTF(ByVal rtf as String) as String
rtb.Rtf = rtf
return rtb.Text
end function

Add a reference to the System.Windows.Forms namespace and create a class instance of System.Windows.Forms.RichTextBox with an instance name of rtb

|||

Hi,

Code Snippet

function StripRTF(ByVal rtf as String) as String
rtb.Rtf = rtf
return rtb.Text
end function

I've similar problem and the above function works in Report Designer. However, when it is deployed in ReportServer, it didn't work at all.

Is there something we need to do in the Report Server?

For your info, both Report Designer and Report Server sits in different machine.

Please help.

Regards

Kamal

No comments:

Post a Comment