Skip to main content

CalculateDocumentVariableEventArgs Class

Contains data for the CalculateDocumentVariable event.

Declaration

export class CalculateDocumentVariableEventArgs extends EventArgs

Remarks

The CalculateDocumentVariable event occurs when a DOCVARIABLE field is updated. The event handler receives an argument of the CalculateDocumentVariableEventArgs type. The argument’s properties provide information specific to this event.

Inheritance

EventArgs
CalculateDocumentVariableEventArgs

Properties

args Property

Provide access to arguments within the DOCVARIABLE field.

Declaration

args: string[]

Property Value

Type Description
string[]

An array containing DOCVARIABLE field arguments.

fieldInterval Property

Returns the text buffer interval that contains the field.

Declaration

readonly fieldInterval: Interval

Property Value

Type Description
Interval

The text buffer interval.

Remarks

options.events.calculateDocumentVariable = (s, e) => {
    if(e.variableName == 'sectionIndex')
        e.value = (rich.document.sections.find(e.fieldInterval.start).index + 1).toString();
};

keepLastParagraph Property

Specifies whether the last paragraph mark of the inserted document is kept in the resulting document.

Declaration

keepLastParagraph: boolean

Property Value

Type Description
boolean

true, to retain the last paragraph mark of the inserted document; otherwise, false.

Remarks

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.

value Property

Specifies the result of the DOCVARIABLE field that fired the event.

Declaration

value: null | string | DocumentProcessorBase

Property Value

Type Description
string

A string that is the field result. null if the field has no result.

DocumentProcessorBase

An object that allows you to insert complex content as a field result.

variableName Property

Gets the name of the document variable to which the DOCVARIABLE field refers.

Declaration

variableName: string

Property Value

Type Description
string

The name of the document variable.

Remarks

The variableName property enables you to identify a document variable for which the event is fired.