Chapter 5, Representing and Processing Rich Text
XFA Specification
Rich Text That Contains External Objects
191
Providing Rich Text Data Through a User Interface
The XFA template may indicate whether the user interface can accept rich text as the value for text. This
indication is supplied with the
allowRichText
attribute in the
textEdit
element. If the
textEdit
element allows rich text, the user may specify styled text, usually through styling buttons. If the
textEdit
element prohibits rich text, rich text may not be provided for the value.
Updating the XML Data DOM
Rich text supplied by the XML Data DOM may be replaced by
plain text when the XML Data DOM is updated. Such replacement
can happen in the following situations:
●
XML Data DOM
In data update,
plain text replaces rich text.
XFA Data DOM
Rich text is not supported by the XFA processing application
or the platform upon which it is running. For example, the
platform is a cell phone with text entry via the keypad.
User is not allowed to supply rich text, as indicated by the
allowRichText
property. For example, the content of the
field is a name (which cannot usefully be styled) but the
default value for the field is, in italics, the words “Not
supplied”.
Text data provided by a calculation.
●
XFA Form DOM
●
Rich Text That Contains External Objects
Rich text may contained attributes that reference external plain-text or rich-text objects. Such external
references are resolved during the layout process. The referenced data is inserted at the point where the
external reference appears and is formatted according to any relevant format picture clauses as described
“Dataflow Paths for Localizing and Canonicalizing Data” on page 143.
XFA provides
span
attributes that
specify the type of reference and whether HTML or CSS specifications in the imported rich text should be
retained, as described in
“Embedded Object Specifications” on page 951.
The bold expressions in the following XFA segment is an example of an embedded object. This example
uses a Script Object Model (SOM) expression to reference the contents of the field named
"AMOUNT OWING". Such SOM expressions are later described in
“Scripting Object Model” on page 81.
<field name="NOTICE">
<ui> … </ui>
<value>
<exData contentType="text/html">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<p>You owe us
<span xfa:embed="AMOUNT_OWING"
xfa:embedMode="formatted"/>! Please
pay before the end of the month.
</p>
</html>
</exData>
</value>