HTML Box

An HTML Box displays an external HTML document in the report.

For information about when to use elements, see Choose report elements.

HTML Box (HTMLBox type) is a layout container, found in the Other Markup group in the Tool Box view.

Warning: Large HTML documents may exhaust memory.

Properties

Select the object on the Report Design page to display its properties in the Properties view.

Use the Location property to specify the location of the HTML document.

By default, the content of an HTML box does not propagate across pages. To split a large HTML Box into chunks using breakpoints, make it the child of a Vertical Box (Mini Page) and set the Split Oversized Items property of the Vertical Box to TRUE.

Note: The splitting of a large element is a costly operation. The element that is split is kept in memory until the last split has been performed. The element that is split should not exceed a few pages. If possible, consider using a Paragraph or PDF Box element, which arrange the content across pages without the need for Split Oversized Items.

Embedding HTML

To embed a resource, use the "data" URL type, which allows the data to be encoded in the body of the URL text. The full syntax of data URLs is:

data:[MIME-type][;charset=encoding][;base64],data

See data URI scheme (Wikipedia link) for a complete description of the concept and the syntax.

For our purposes, it is sufficient to support a simplified subset that omits the charset and assumes that characters are encoded in UTF-8. Image data is always encoded in base64 (Wikipedia link) while other data such as HTML content is typically "Percent encoded" (Wikipedia link).

For HTML content, a URL has the form:
data:text/html, data

where data is the percent encoded data of the HTML document.

To embed HTML, use the data protocol syntax in the Location property of the HTMLBOX element.

To automatically construct this URL, click the ... button for the Location property. Choose the file and select the Embed in document check box.

Figure: Embed in document checkbox

The figure is a screenshot showing the Embed in document checkbox, which allows you to embed an HTML document in a report.

Populating HTML content from text variables

Enter the code in the Expression Editor for the Location property of the HTML Box, including the name of the text variable.

Figure: RTL Expression

The figure shows a method of populating HTML content from text variables using the RTL Expression: "data:text/html,"+htmldescription.urlEncode().

To encode the data using percent encoding, use the function String.urlEncode().