TrackedChange Object
Description
A TrackedChange object represents a change made to the document after anyone has revised the document. After tracking changes has been turned on with the setIsTrackChangesEnabled method, a TextControl marks up new changes made to the document. Every change is represented through a TrackedChange object, all of these objects are contained in the TrackedChangeCollection which can be obtained with the trackedChanges property.
Syntax
TrackedChangeExamples
The following example demonstrates TrackedChange in a practical document-editing workflow. A TrackedChange object represents a change made to the document after anyone has revised the document. After tracking changes has been turned on with the setIsTrackChangesEnabled method, a TextControl marks up new changes made to the document. Every change is represented through a TrackedChange object, all of these objects are contained in the TrackedChangeCollection which can be obtained with the trackedChanges property.
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(trackedChange) {
if (!trackedChange) {
console.warn("No tracked change is available at the current input position.");
return;
}
trackedChange.getText(
function(result) {
console.log("get text result:", result);
},
onTxError
);
}, onTxError);
}, onTxError);Members
Methods
| Method | Description |
|---|---|
| getActive | Gets a value specifying whether the TrackedChange is currently active or not. |
| getChangeKind | Gets the kind of change. |
| getChangeTime | Gets the date and time when the change has been made. |
| getHighlightColor | Gets the highlight color for the tracked change. |
| getHighlightMode | Gets a value indicating whether the tracked change is highlighted. |
| getLength | Gets the number of changed characters. |
| getNumber | Gets the change's number. |
| getStart | Gets the index (one-based) of the first changed character. |
| getText | Gets the changed text. |
| getUserName | Gets the name of the user who has done the change. |
| save | Saves the tracked change in a certain format and sends the result back asynchronously by calling a given callback function. |
| setActive | Sets a value specifying whether the TrackedChange is currently active or not. |
| setHighlightColor | Sets the highlight color for the tracked change. |
| setHighlightMode | Sets a value indicating whether the tracked change is highlighted. |