Telerik Reporting R3 2016


The HtmlTextBox report item allows developers to insert HTML-formatted text into a report. You can specify the HTML value at design time (either through a WYSIWYG editor or through an expression editor), or retrieve it from a data source using any simple or complex expression that evaluates to correctly formatted HTML.

You can define colors, fonts, and other behavior on any subset of text within a single HtmlTextBox to create a mail merge or template for text in your report. You can also use multiple paragraphs inside a single text box. You can also set an alignment value for any individual string of text.

Note Note

Known Limitations:

  • The HtmlTextBox works with the text formatting options only.

  • The HtmlTextbox is rendered as plain text with no formatting in Excel.

  • RTL (Right to Left) is not supported.

  • HyperLink (<A> tag) is interactive (acts as actual hyperlink) under HTML rendering extension only.

  • Any limitations of the HtmlTextBox in specific export formats are reflected in the respective topic in the Design considerations for Report Rendering help section.

Supported HTML tags

Various formatting options are available to control the text presentation:

  • Font, size (relative size against the font size of the item, default is 3 (1-7)), color (<FONT>)

  • Bold, Italic, Underline (<strong>,<b>, <em>, <i>, <u>)

  • Subscript, Superscript (<sub>,<sup>)

  • HyperLink (<a href target>)

  • Lists (<ol>, <ul>, <li>)

  • Organize the text in paragraphs (<div>, <span>,<p>, <br>, <center>)

Supported CSS attributes

  • background-color

  • border, border-color, border-width, border-style

  • text-align (center, left, right, justify), text-decoration (none, underline, line-through)

  • font-family, font-size, font-weight

  • padding, padding-bottom, padding-top, padding-right, padding-left

  • color

Note Note

When you import text that contains HTML markup, the data is always parsed by the HtmlTextBox first. Because only a subset of HTML tags is supported, the HTML that is shown in the rendered report may differ from your original HTML.

Also according to the HTML specification (and the general XML specification as well) the "&", "<" and ">" characters are considered special (markup delimiters), so they need to be encoded in order to be treated as regular text. For example the "&" character can be escaped with the "& amp;" entity. More information on the subject you can find in this article.

Any other HTML markup tags will be ignored during report processing. If the HTML represented by the expression in the HtmlTextBox is not well formed, the HtmlTextBox would throw an exception. All HTML tags are case-insensitive.

Growing and Shrinking

By default, HtmlTextBoxes are a set size. If you want to allow an HtmlTextBox to expand vertically based on its contents, set the CanGrow property to True (default value). If you want to allow a TextBox to shrink based on its contents set the CanShrink property to True (default value is False). The HtmlTextBox would always grow to accommodate the first line of text even when CanGrow is False.

Embedded expressions

The item supports embedded expressions for mail merge functionality. Embedded expressions give you the freedom to get and insert data-driven information directly into the text box report item to produce customized reports and mail merging.

After the expression evaluation/replacement, the value of the HtmlTextBox must be valid XHTML.


The HtmlTextBox supports data-driven in-line fields, which are editable either in-place or through design-time editor, available directly in Visual Studio and the Standalone Report Designer.  

The in-place editor for the HTML text box report item (as with the TextBox item) allows you to quickly enter text directly into the designer where the report item is rather than having to go look for a property in the property grid. To activate the in-place editor, double-click the HtmlTextBox or select it and press F2. Once the in-place editor is activated:

  • Enter accepts all changes.

  • Esc discards all changes.

  • Moving focus away from the HtmlTextBox also accepts all changes.

The screenshot below shows an HtmlTextBox with the in-place editor active.

The design time editor supports two modes:

  1. Interactive (Design view) - you can select portion of the text and make it bold, change its font, size, color, etc. using appropriate controls like comboboxes and buttons (WYSIWYG editor). Internally the designer generates valid HTML source and stores it in the Value property of the item. Adding embedded expressions is possible, however the whole Html value cannot be an expression. You can switch to Html view at any time if needed.

    Note Note

    Pressing the Enter key inserts a new paragraph or new list item depending on the current context. Note that it does NOT insert <br /> (new line). To insert new line, use the button on the toolbar)

    Html Text Box Design View
  2. Expression (Html view) - the user enters raw HTML tags and text into the source editor. The value can be expression or text containing embedded expressions. The user can switch to Design view unless the value is an expression.

    Html Text Box Html View
Note Note

MultiLine and TextWrap concepts are always true for HtmlTextBox.

The subscript and superscript tags can be nested (i.e. <sub>subscript1<sub>subscript2</sub></sub>), resulting in gradually smaller font sizes and offsets. However, the corresponding toolbar buttons only toggles the subscript or superscript feature, so if nested tags are needed, the appropriate code should be added manually using the editor's Html view.