donderdag 10 juni 2010

Render html in a reportviewer textbox

Starting with Visual Studio 2010, the included Microsoft ReportViewer control (ReportViewer v10) supports the rendering of HTML inside a textbox. With this functionality, you can use multiple styles inside one textbox.

The supported text format tags you can use are the following: <B>, <I>, <U>, <S>.

The default behaviour the textbox uses is to render plain text, but it’s very easy to activate the html rendering on a specific textbox containing a placeholder:

  1. Starting situation: a textbox with placeholder
    Textbox with placeholder
    (You can easily add a placeholder by dragging it from the datasource window to a specific textbox)
  2. Select the placeholder by clicking on it
    Selected placeholder
  3. Right click the selected placeholder and select ‘Placeholder properties’.
    Rightclick placeholder
  4. A property window opens:
    Placeholder properties window
  5. In the general tab, switch the rendering to HTML:
    Render html
  6. Now save your report and the HTML text you pass to the placeholder will be rendered correctly.

More information on the supported html tags you can use and useful guidelines (and limitations of the html rendering inside a reporting services report) can be found here: http://msdn.microsoft.com/en-us/library/cc645967.aspx

Geen opmerkingen:

Een reactie posten