Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to render the formated text in the report.rdlc (with its format)

I store my data in formatted way in my db , I want some way to render the text with its format in my report.rdlc i use visual studio 2008 How to do this :


For example :

if my text like this :

<p>text</p>

It appears the same with tags in my report text box !!. instead of rendering as a paragraph.


when i bind like this :

= Fields.subject

How to fix this problem ?


enter image description here

like image 981
Anyname Donotcare Avatar asked May 19 '13 12:05

Anyname Donotcare


2 Answers

Edit

After researching this problem a bit more it appears Visual Studio doesn't support Markup as HTML for rdlc reports until Visual Studio 2010. So if upgrading is an option, then you can do what you want.

Otherwise you could always just strip out the HTML tags like so:

On the Report menu, click Report Properties... and select the Code tab. Enter the following code:

Function StripHTMLTags(ByVal text as String) AS String
  Return System.Text.RegularExpressions.Regex.Replace(text, "<(.|\n)*?>", "")
End Function

Now in your cell use the following expression:

=Code.StripHTMLTags(Fields!MyField.Value)

Original answer follows:

Leaving aside that you should separate data from presentation, you can render using HTML tags in Reporting Services, its just not very intuitive to find:

  1. Left click the field you want to display so that the <Expr> tag is highlighted
  2. Right click the highlighted <Expr> tag and choose Placeholder Properties...
  3. On the General tab, select the HTML- Interpret HTML tags as style radio button

Only a limited number of tags are supported however. This article on MSDN tells your more.

Screenshots:

enter image description here

enter image description here

like image 113
Chris Latta Avatar answered Nov 05 '22 20:11

Chris Latta


  1. Double click at field area
  2. At Placeholder properties choose General > HTML - Interpret HTML tags as styles

field area

like image 23
Wildan Muhlis Avatar answered Nov 05 '22 19:11

Wildan Muhlis