This documentation is archived and is not being maintained.

Optimizing Report Layout for HTML Output (Visual Studio Report Designer)

Visual Studio 2008

This topic describes pagination and positioning of report items for HTML reports that are displayed in the ReportViewer Web server control. This information is useful if you want to understand the HTML presentation of a report. HTML output is regenerated each time you run the report. A built-in rendering extension determines the HTML output, including how report items are positioned and styled. The built-in HTML rendering extension cannot be customized. You cannot change the HTML tagging it produces or replace existing format elements with a different implementation.

HTML Support

HTML 4.0 reports conform to the HTML 4.0 and Cascading Style Sheets level 2 (CSS2) specifications, with some exceptions. All HTML is generated with UTF-8 encoding.


This topic makes references to elements of a report. Report elements are part of the Report Definition Language (RDL), which provides a formal description of report structure. The RDL is documented in SQL Server 2005 Books Online.

Positioning of Items

To output a report in HTML, the control builds a table in HTML to contain the items in each set of report items. Items are positioned within the table to preserve the layout of the report. If the set of report items contains only one report item, the report item is rendered without the table. All locations and item sizes are expressed in millimeters (mm). Differences in sizes and positions of less than 0.2 mm are rendered as 0 mm.

HTML does not support item overlapping. If a report item overlaps another item, the items are arranged so that they do not overlap. This may result in items appearing on the page in different positions than was designed. In some cases, items may appear to not overlap in a design tool, but in fact do overlap. The size and position properties for the report items will reveal their true position. To determine the position of overlapping items, the rendering extension first considers the value of the Top element for the items, then the value of the Left element, and then the value of ZIndex.


The HTML rendering extension renders pages as separate HTML pages, also known as "sections," as follows:

  • Page breaks will render when the following items are placed within a list with a page break or placed directly within the body of the report:

    • Rectangles with PageBreakAtEnd or PageBreakAtStart set to True.

    • Lists or list groups with PageBreakAtEnd or PageBreakAtStart set to True.

    • Tables or table groups with PageBreakAtEnd or PageBreakAtStart set to True. The table must have at least one visible column. All parent groups for a table group must be visible.

    • Matrices or row groups with PageBreakAtEnd or PageBreakAtStart set to True.

    • Subreports with any of the above items.

  • Items that begin above an item that contains a page break will appear on the page before the page break.

The HTML rendering extension will attempt to render all page breaks in items as described previously; however, two items with page breaks that are positioned next to each other on the page may yield unpredictable results. Items that have page breaks and that are contained within a table, matrix, or rectangle may also yield unpredictable results.

Any item placed next to an item with a page break will be rendered on the same page if the top of the item is above the bottom of the item with the page break. For example, a text box that is placed directly to the right of a table that has a page break at the end of the table will appear on the same page as the table. A text box that is placed to the right of and below the bottom of the same table will appear on the next page.

The HTML rendering extension will also insert page breaks at the approximate height of the page as defined in the properties for the report. This is primarily to prevent a large report with no page breaks from generating extremely large HTML pages when rendered.


Style elements are rendered as CSS styles for HTML 4.0. For HTML 4.0, a single CSS style is rendered for each report item. The names of the styles are unique across reports and subreports. The following table indicates how RDL style attributes map to HTML styles.

RDL style Description HTML 4.0


Color of the border.



Style of the border.



Width of the border.



Color of the background.



URL of the background image.



Repeat pattern of background image.



Style of font (Normal, Italic).



Size of font.



Weight of text.



Decoration of text (Underline, Strikethrough).



Horizontal alignment of text.



Vertical alignment of text.



Color of text.



Size of padding between left border and text.



Size of padding between right border and text.



Size of padding between top border and text.



Size of padding between bottom border and text.



Height of the lines of text.



Right-to-left or left-to-right.

DIR attribute


Language of the text.

LANG attribute


Override of the bi-directional algorithm.



Borders with a border style of Double and a border width of less than 2 pt are rendered as a single line by the HTML rendering extension. A border with a border style of Double must have a border width of at least 2 pt to display both lines.

See Also