Word.RevisionType enum
Specifies the revision type.
Remarks
Used by
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/track-moved-text.yaml
// Reads and selects the text associated with a tracked move.
await Word.run(async (context) => {
const document: Word.Document = context.document;
const revisions: Word.RevisionCollection = document.revisions;
revisions.load("items/type");
await context.sync();
const movedFrom: Word.RevisionType = Word.RevisionType.movedFrom;
const movedTo: Word.RevisionType = Word.RevisionType.movedTo;
const movedRevision: Word.Revision | undefined = revisions.items.find(
(revision: Word.Revision) => revision.type === movedFrom || revision.type === movedTo
);
if (!movedRevision) {
console.log("Revision types found:", revisions.items.map((revision: Word.Revision) => revision.type));
console.warn("No tracked move was found. Move an entire paragraph as described in the task pane; moving a phrase may produce insertion and deletion revisions instead.");
return;
}
const movedRange: Word.Range = movedRevision.movedRange;
movedRange.load("text");
movedRange.select();
await context.sync();
console.log(`Moved revision range text: ${movedRange.text}`);
});
Fields
| cellDeletion = "CellDeletion" | Cell deletion revision. |
| cellInsertion = "CellInsertion" | Cell insertion revision. |
| cellMerge = "CellMerge" | Cell merge revision. |
| cellSplit = "CellSplit" | Cell split revision. |
| conflict = "Conflict" | Conflict revision. |
| conflictDelete = "ConflictDelete" | Conflict delete revision. |
| conflictInsert = "ConflictInsert" | Conflict insert revision. |
| delete = "Delete" | Delete revision. |
| displayField = "DisplayField" | Display field revision. |
| insert = "Insert" | Insert revision. |
| movedFrom = "MovedFrom" | Moved from revision. |
| movedTo = "MovedTo" | Moved to revision. |
| none = "None" | No revision. |
| paragraphNumber = "ParagraphNumber" | Paragraph number revision. |
| paragraphProperty = "ParagraphProperty" | Paragraph property revision. |
| property = "Property" | Property revision. |
| reconcile = "Reconcile" | Reconcile revision. |
| replace = "Replace" | Replace revision. |
| sectionProperty = "SectionProperty" | Section property revision. |
| style = "Style" | Style revision. |
| styleDefinition = "StyleDefinition" | Style definition revision. |
| tableProperty = "TableProperty" | Table property revision. |