Rich Text Box

A Rich Text Box displays rich text that is input from the fglrichtext web component. It can also be used to display a PXML document in the report.

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

Note: To display content from external HTML documents, use the HTML Box.

Rich Text Box (RichTextBox type) is a layout container, found in the Other Markup group in the Tool Box view. The Rich Text Box propagates if the document has more than one page.

The Reports demo includes a RichText section, where you can view the source file, form, and report design. From this section, you can execute an application that includes a Rich Text box.

Properties

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

Use the Type property to specify whether the document is HTML, XHTML, or PXML format.

Use the Location property to specify the location of the document using a URL.

Embedding documents

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 PXML content, a URL has the form:
data:text/xml, data
For HTML or XHTML content, a URL has the form:
data:text/html, data

where data is the percent encoded data of the document.

To embed HTML, XHTML, or PXML, use the data protocol syntax in the Location property of the Rich Text Box.

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 XHTML document in a report.

Considerations for HTML and XHTML documents

The XHTML Rich Text Box is provided to render rich text input from the fglrichtext web component into documents.

Properties or elements that are not supported may silently be ignored at runtime.

CSS styles must be contained in the HTML document using a <style> element. References to external CSS files (for example, using <link> tags) are not supported.

Example: Displaying PXML content depending on a variable

In this example, all PXML documents are stored in the directory C:/My Docs/pxml/, and the document name is determined by the field orderline.product.pxml. Enter the following in the Expression Editor for the Location property:

"file:///C:/My Docs/pxml/"+orderline.product.pxml.trim()