HTML Box

An HTML Box displays an image of an HTML document in the report.

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

Note: The content of an HTML box cannot span pages.

Properties

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

Use the Location property to specify the file name and path of the HTML document.

Embedding HTML

To embed a document, use a URL type that allows encoding the data 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

Data in text variables is typically input into a database using a TextEdit form field, with the textFormat style attribute set to html. See the Presentation Styles topic in the Genero Business Development Language User Guide for more details.

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().