Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Formatting Text and Importing HTML (Report Builder 2.0)

A text box can be a report item or an individual cell within a data region that contains text, a calculated field, a pointer to a field in a database, or a combination of all three items. You can mix fonts and colors, add bold and italic styles, and use paragraph styles such as alignment and hanging indents. You can format an entire text box or you can format specific text, numbers, expressions, or fields within the text box.

Font, size, color, and effects all contribute to the readability of a report. Font, font style, font size, and underline effects can be applied to text within a text box or data region. By default, the report font that is used is Arial, 10 points, and black. By using the Text Box Properties dialog box, you can specify how the text appears when the report is rendered.

When a simple or complex expression is defined inside a text box, the resulting UI representation of this expression is known as a placeholder. You can define colors, fonts, actions, and other behavior on any number of placeholders or sections of text within a single text box.

The value of a placeholder is always a simple or complex expression. You can add a placeholder to a text box by creating an expression using one of the following methods:

  • Drag a field from the Report Data pane and drop it into the text box. If you drag the expression anywhere else on the report body, a new text box will be created that contains the placeholder. The value of this placeholder will be the field expression that corresponds to the field that was dropped.

  • Right-click anywhere in the text box and select Insert Placeholder. In the Placeholder Properties dialog box, you can specify an expression as the value of your placeholder. For more information, see Placeholder Properties Dialog Box, General (Report Builder 2.0).

  • Type any simple or complex expression into the text box. For example, if you type Name: [Name] into the text box, the [Name] text will be displayed as a placeholder that represents the expression =Fields!Name.Value. For more information about the types of display text supported for expressions, see Understanding Simple and Complex Expressions (Report Builder 2.0).

  • Type an expression in an empty text box by starting with an equal sign (=). When you change the focus off the text box, the resulting expression is converted into a placeholder that you can edit. If the text box is not empty, or the equal sign is inserted anywhere but as the first character in the text box, the equal sign is treated as a string literal and a placeholder is not created. For more information about defining simple and complex expressions, see Using Expressions (Report Builder 2.0).

You can format placeholders using the Placeholder Properties dialog box. You can format only the entire placeholder, not sections of the placeholder. If you want to see the underlying expression, you can pause your pointer on the placeholder. You can change the underlying expression by double-clicking the placeholder or right-clicking the placeholder and selecting Placeholder Properties. You can also specify a UI label using the Label property in General of the Placeholder Properties dialog box. This will be the text that is shown at design-time for the placeholder.

Unlike placeholder text, you can align individual text in a text box separately, use multiple paragraphs within a single text box, and define other behavior for any subset of text

You can define colors, fonts, actions, and other behavior on any subset of text within a single text box to create a mail merge or template for text in your report. You can also use multiple paragraphs inside a single text box. For example, if you have two separate paragraphs of text, you can separate the paragraphs by pressing ENTER in the text box. You can also set an alignment value for any individual string of text. You can also define an action for individual text in a text box. This can be useful if you want to add a hyperlink for a string of text that is contained inside a text box.


Actions defined on the text box have a higher priority than actions defined for individual text in a text box.

For more information about mixed formatting, see How to: Format Text in a Text Box (Report Builder 2.0).

The text box report item enables you to insert HTML-formatted text that you have retrieved from a field in your dataset into a report. The text can come from any simple or complex expression that evaluates to correctly formatted HTML. Formatted text can be rendered to all supported output formats, including PDF.


When you import text that contains HTML markup, the data must always be parsed by the text box 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.

The following is a complete list of tags that will render as HTML when defined as placeholder text:

  • Hyperlinks: <A href>

  • Fonts: <FONT>

  • Header, style and block elements: <H{n}>, <DIV>, <SPAN>,<P>, <DIV>, <LI>, <HN>

  • Text format: <B>, <I>, <U>, <S>

  • List handling: <OL>, <UL>, <LI>

Any other HTML markup tags will be ignored during report processing. If the HTML represented by the expression in the placeholder text is not well formed, the placeholder is rendered as plain text. All HTML tags are case-insensitive.

If the text in your text box contains only one block of text, any HTML in the placeholder that defines block elements will render correctly. However, if the text box has multiple blocks of text, the HTML tags are ignored and the structure of the text is defined by the blocks of text.

If more than one tag is defined for text, and Reporting Services detects a conflict between the HTML and existing report constraints, only the innermost HTML tag will be treated as HTML.

For more information, see How to: Add HTML into a Report (Report Builder 2.0).

When using cascading style sheet (CSS) attributes, only a basic set of tags are defined. The following is a list of attributes that are supported:

  • text-align, text-indent

  • font-family, font-size

  • color

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

  • font-weight

Here are some considerations for using CSS:

  • Malformed CSS values are ignored in the same way as malformed HTML.

  • When both attribute and CSS style attributes exist in the same tag, the CSS property has a higher precedence. For example, if your text is <p style="text-align: right" align="left">, only the text-align attribute will be applied.

  • For attributes and CSS styles, if a property is specified more than once, only the last instance of the property is applied. For example, if your text is <p align="left" align="right">, the text will be right-aligned.

In Alignment on the Text Box Properties dialog box, you can specify how the text should be aligned horizontally. If you do not specify a value for alignment, the default value of the alignment is Default. This means that the text is aligned based on the field type of your placeholder value. If you specify an expression that evaluates to a non-string value, text is aligned to the right. If your expression evaluates to a string value, text is aligned to the left.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.