Bagikan melalui


Importing HTML into a Report (Report Builder and SSRS)

You can use a text box 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.

Text formatted with HTML

This illustration shows text with HTML formatting in report design view, and the same text as it is rendered when the report is run.

Note

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.

To quickly get started, see Tutorial: Formatting Text (Report Builder 3.0).

Note

You can create and modify report definitions (.rdl) in Report Builder 3.0 and in Report Designer in Business Intelligence Development Studio. Each authoring environment provides different ways to create, open, and save reports and related items. For more information, see Designing Reports in Report Designer and Report Builder 3.0 (SSRS) on the Web at microsoft.com.

Supported HTML Tags

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 3.0 and SSRS).

Limitations of Cascading Style Sheet Attributes

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 and the text will be right-aligned.

  • 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.