Optimizing Report Layout for HTML Output (Visual Studio Report Designer)
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.
Note
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.
Pagination
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
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 |
---|---|---|
BorderColor |
Color of the border. |
border |
BorderStyle |
Style of the border. |
border |
BorderWidth |
Width of the border. |
border |
BackgroundColor |
Color of the background. |
background-color |
BackgroundImage |
URL of the background image. |
background-image |
BackgroundRepeat |
Repeat pattern of background image. |
background-repeat |
FontStyle |
Style of font (Normal, Italic). |
font-style |
FontSize |
Size of font. |
font-family |
FontWeight |
Weight of text. |
font-weight |
TextDecoration |
Decoration of text (Underline, Strikethrough). |
text-decoration |
TextAlign |
Horizontal alignment of text. |
text-align |
VerticalAlign |
Vertical alignment of text. |
vertical-align |
Color |
Color of text. |
color |
PaddingLeft |
Size of padding between left border and text. |
padding-left |
PaddingRight |
Size of padding between right border and text. |
padding-right |
PaddingTop |
Size of padding between top border and text. |
padding-top |
PaddingBottom |
Size of padding between bottom border and text. |
padding-bottom |
LineHeight |
Height of the lines of text. |
Line-height |
Direction |
Right-to-left or left-to-right. |
DIR attribute |
Language |
Language of the text. |
LANG attribute |
UnicodeBiDi |
Override of the bi-directional algorithm. |
unicode-bidi |
Note
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
Concepts
Configuring ReportViewer for Remote Processing
Creating Client Report Definition (.rdlc) Files
ReportViewer Web Server and Windows Forms Controls