The online document editor provides a default merge field behavior including a specific highlight color, a doubled input position and a highlight mode. When loading an Office Open XML (DOCX) document, this behavior can be adjusted programmatically to provide the same look and feel.
The following screenshot shows the default behavior of merge fields in the document editor:
After loading an Office Open XML (DOCX) document into the editor, the fields are imported, but the default behavior is different. The user is only able to see that there is a field at the input position by hovering over the field using the mouse or by checking the enabled ribbon bar buttons such as Field Properties:
The reason why this behavior is not restored is that these properties can be adjusted for each field individually and that the MS Word format (DOCX) doesn't provide such a feature. If you store the document in the internal TX Text Control format, those properties are stored and loaded automatically.
|field.setHighlightColor("rgba(0, 0, 0, 0.235)");|
After this, the fields are highlighted in the default color and the doubled input position is added: