DocumentVariableData Class

Contains DOCVARIABLE field data.

Declaration

export class DocumentVariableData

Remarks

The CalculateDocumentVariableAsync event allows you to calculate results of all DOCVARIABLE fields in a document. The event's data parameter returns an array of the DocumentVariableData objects that contain DOCVARIABLE field data.

richEdit.events.calculateDocumentVariableAsync.addHandler(function(s, e) {
  e.data.forEach(function(data) {
    data.callback('Result Of ' + data.variableName);
  });
});

Properties

args Property

Gets field arguments.

Declaration

args: string[]

Property Value

Type Description
string[]

An array of field arguments.

Remarks

A DOCVARIABLE field has the following syntax: { DOCVARIABLE "variable name" "argument1" "argument2"... }. Use the args property to get access to an array of field arguments.

callback Property

Set the result of the DOCVARIABLE field.

Declaration

callback: (value: null | string | DocumentProcessorBase, keepLastParagraph?: boolean) => void

Property Value

Type Description
(value: null | string | DocumentProcessorBase, keepLastParagraph?: boolean) => void

The value parameter specifies the field result.
The keepLastParagraph parameter specifies whether the last paragraph mark of the inserted document is kept in the resulting document.

Remarks

Call the callback function to set the result of the DOCVARIABLE field. The result value can be one of the following types:

  • null - the field has no result;
  • a string value that is the field result;
  • an DocumentProcessorBase object that allows you to insert complex content as a field result.

The keepLastParagraph property is in effect when the value property is set to an instance of the DocumentProcessorBase class. Set the keepLastParagraph property to true to add the last paragraph mark of the inserted document to the resulting document.

fieldInterval Property

Gets the text buffer interval that contains the field.

Declaration

readonly fieldInterval: Interval

Property Value

Type Description
Interval

The text buffer interval.

variableName Property

Gets the name of the document variable.

Declaration

variableName: string

Property Value

Type Description
string

The name of the document variable.

Remarks

A DOCVARIABLE field has the following syntax: { DOCVARIABLE "variable name" "argument1" "argument2"... }. Use the variableName property to identify a document variable by its name.