Live reporting fields
Insert and inspect merge fields
Create Word-compatible reporting placeholders, move the caret into a field, and inspect how its visible text relates to its field instructions.
{{
Place the caret in a fieldThe inspector follows the application field at the current input position.
Application fields in this text part
0 fields
Reading the application field collection...
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Field definitions become Word-compatible document objects
Merge fields connect template locations to data source columns. Conditional fields add simple decision logic, while the persisted application field keeps both its visible placeholder and its underlying Word field instructions.
Field insertion
TXTextControl.addMergeField
Field definitions
MergeField / IfField
Persisted fields
TXTextControl.applicationFields
Field instructions
ApplicationField.getParameters / setParameters
How it works
A new MergeField describes the data column name, initial visible text, optional numeric or date format, and whether formatting should survive a merge. TXTextControl.addMergeField inserts that definition at the current input position.
An IfField stores two expressions, a RelationalOperator, and separate result text for true and false comparisons. It is inserted through the same API because both definitions become Microsoft Word-compatible fields.
After insertion, TXTextControl.applicationFields exposes the persisted ApplicationField. getTypeName identifies fields such as MERGEFIELD and IF; getParameters returns the field instructions; and inherited TextField members expose the visible text and document range.
ApplicationField.scrollTo moves the caret to a collection item. ApplicationFieldCollection.remove can either delete the complete field or retain its visible text as ordinary document content.
const field = new TXTextControl.MergeField();
field.name = "InvoiceTotal";
field.text = "«InvoiceTotal»";
field.numericFormat = "$#,###.00";
field.preserveFormatting = true;
TXTextControl.addMergeField(field);