TrackedChangeCollection Object
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
TrackedChangeCollectionExamples
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
| Method | Description |
|---|---|
| elementAt | Returns the element at a specified index in the collection. (Inherited from Collection.) |
| forEach | Executes a callback function for each element. (Inherited from Collection.) |
| getCount | Gets the number of elements contained in the collection. (Inherited from Collection.) |
| getItem | Gets 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. |
| remove | Removes 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. |