Rich Text Box
A Rich Text Box displays an image of an HTML, XHTML, or PXML document in the report.
Rich Text Box (RichTextBox type) is a layout container, found in the Drawables 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 file name and path of the document.
Embedding documents
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).
data:text/xml, data
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:
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()