TX Text Control .NET Server

TrackedChangeCollection Object

Object|Introduced in 28.0

Description

Contains all tracked changes in the main text or another part of a document. It is a collection of objects of the type TrackedChange. A TrackedChange object represents a change of the document after someone has reworked the document. After tracking changes has been turned on with the setIsTrackChangesEnabled method, the made changes to the document will be tracked.

Syntax

TrackedChangeCollection

Examples

The following example demonstrates TrackedChangeCollection in a practical document-editing workflow. It contains all tracked changes in the main text or another part of a document. It is a collection of objects of the type TrackedChange. A TrackedChange object represents a change of the document after someone has reworked the document. After tracking changes has been turned on with the setIsTrackChangesEnabled method, the made changes to the document will be tracked.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const trackedChanges = mainText.trackedChanges;
    trackedChanges.getItem(
        function(change) {
            if (!change) {
                console.warn("No tracked change was returned.");
                return;
            }
            
            console.log("get item result:", change);
        },
        true,
        onTxError
    );
}, onTxError);

Members

Methods

MethodDescription
elementAtReturns the element at a specified index in the collection. (Inherited from Collection.)
forEachExecutes a callback function for each element. (Inherited from Collection.)
getCountGets the number of elements contained in the collection. (Inherited from Collection.)
getItemGets the change at the current text input position or the next or the previous change in the textflow. The search begins at the current text input position. If there is more than one change at the current input position the innermost change is returned.
removeRemoves a tracked change from the collection. Depending on the accept parameter the change is either accepted or rejected. When a change is rejected, inserted text is removed and deleted text is reinserted.

Further Reading