Skip to main content
A newer version of this page is available. .
cut

RichEditCommands.createField Property

Gets a command to add a field at the current position in a document.

Declaration

createField: CreateFieldCommand

Property Value

Type Description
CreateFieldCommand

A CreateFieldCommand object that provides methods for executing the command and checking its state.

Remarks

You can invoke this command by calling the execute method.

The execute method checks the command state (obtained using the getState method) before executing, and decides whether the action can be performed. The execute and getState methods are members of the CreateFieldCommand class.

You can execute the command without parameters or with an optional code parameter depending on your requirements:

  • The command without parameters creates an empty field and populates it with characters in the selected range if there are any;
  • The command with the code parameter creates and updates a field containing text received from the parameter.

Usage example:


richEdit.commands.createField.execute();
richEdit.commands.createField.execute("TOC \\h \\c \"Figure\"");
See Also