Revision
API operations for the Revisions and RevisionsFilter objects of Word documents in IMM WebOffice SDK for JavaScript.
Revisions
ActiveDocument.Revisions
All revisions in the document.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisionsexpression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; }
Methods
ActiveDocument.Revisions.AcceptAll()
Accepts all revisions in the document.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.AcceptAll()expression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Accept all revisions. await revisions.AcceptAll(); }
ActiveDocument.Revisions.Item()
Gets a Revision object from the Revisions collection by index.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index)expression: an Application object.
-
Parameters
Parameter
Type
Required
Description
Index
Number
Yes
The index of the Revision object to retrieve.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const Revisions = await app.ActiveDocument.Revisions; // Get a Revision object by index. await Revisions.Item(1); }
ActiveDocument.Revisions.Json()
Gets all revision data in the document.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Json()expression: an Application object.
-
Return values
An
Array.<Object>where each item has the shape[{ user, ... }]. The following table describes the fields.Field
Type
Description
user
String
The username of the reviewer.
leader
String
The comment on the revision.
begin
String
The start position of the revision.
end
String
The end position of the revision.
content
String
The revised content.
type
String
The revision type.
date
Number
The Unix timestamp when the revision was made.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get revision data as a JSON array. const revisionData = await revisions.Json(); console.log(revisionData); }
ActiveDocument.Revisions.RejectAll()
Rejects all revisions in the document.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.RejectAll()expression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Reject all revisions. await revisions.RejectAll(); }
ActiveDocument.Revisions.SwitchRevisionBtn()
Shows or hides the Accept and Reject buttons.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.SwitchRevisionBtn({ Value })expression: an Application object.
-
Parameters
Valueis of typeBoolean. Set totrueto show the Accept and Reject buttons, orfalseto hide them. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Hide the Accept and Reject buttons. await revisions.SwitchRevisionBtn(false); }
ActiveDocument.Revisions.SetRevisionMarkVisibilityByUserInfo()
Sets revision mark visibility by username. The setting applies to the current page only and is reset on page refresh.
Only IMM WebOffice SDK for JavaScript V1.1.12 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.SetRevisionMarkVisibilityByUserInfo(UserInfos)expression: an Application object.
-
Parameters
The following table describes the fields in the
UserInfosarray.Parameter
Type
Required
Description
userName
String
No
The username of the reviewer.
visible
Boolean
No
Specifies whether revision marks are visible. Valid values:
-
false (default): hides revision marks
-
true: shows revision marks
-
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Hide revision marks for a specific user. await revisions.SetRevisionMarkVisibilityByUserInfo([{ userName: "user01", visible: false }]); }
Properties
ActiveDocument.Revisions.Count
The total number of revisions in the document.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Countexpression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the total number of revisions. const count = await revisions.Count; console.log(count); }
ActiveDocument.Revisions.RevisionsMode
The display mode for revisions.
Only IMM WebOffice SDK for JavaScript V1.1.16 and later support this feature.
-
Syntax
expression.RevisionsModeexpression: an Application object.
0specifies the default mode.1specifies the inline mode. -
Example
//@file=base.docx async function example() { await instance.ready(); const app = instance.Application; const revisions = await app.ActiveDocument.Revisions; revisions.RevisionsMode = 1; }
ActiveDocument.Revisions.ShowRevisionsFrame
Specifies whether to show revision balloons.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ShowRevisionsFrameexpression: an Application object.
truespecifies that revision balloons are shown, andfalsespecifies that revision balloons are hidden. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Show revision balloons. revisions.ShowRevisionsFrame = true; }
Revision
ActiveDocument.Revisions.Item()
Gets a single Revision object.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index)expression: an Application object.
-
Parameters
Parameter
Type
Required
Description
Index
Number
Yes
The index of the Revision object to retrieve.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the first revision. const revision = await revisions.Item(1); }
Methods
ActiveDocument.Revisions.Item(Index).Accept()
Accepts a single revision.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index).Accept()expression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the first revision. const revision = await revisions.Item(1); // Accept the revision. await revision.Accept(); }
ActiveDocument.Revisions.Item(Index).Reject()
Rejects a single revision.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index).Reject()expression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the first revision. const revision = await revisions.Item(1); // Reject the revision. await revision.Reject(); }
Properties
ActiveDocument.Revisions.Item(Index).Author
The name of the reviewer who made the specified revision.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index).Authorexpression: an Application object.
-
Return value
A
Stringwith the reviewer's name. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the first revision. const revision = await revisions.Item(1); // Get the reviewer's name. const author = await revision.Author; console.log(author); }
ActiveDocument.Revisions.Item(Index).Date
The date and time when the specified revision was made.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index).Dateexpression: an Application object.
-
Return value
A
Dateobject with the date and time of the revision. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the first revision. const revision = await revisions.Item(1); // Get the date and time of the revision. const date = await revision.Date; console.log(date); }
ActiveDocument.Revisions.Item(Index).Range
The range of the specified revision.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index).Rangeexpression: an Application object.
-
Return value
A
Rangeobject representing the revision range. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the first revision. const revision = await revisions.Item(1); // Get the revision range. const range = await revision.Range; console.log(range); }
ActiveDocument.Revisions.Item(Index).Type
The type of the specified revision.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Revisions.Item(Index).Typeexpression: an Application object.
-
Return value
An
Enumindicating the revision type. For more information, see WdRevisionType. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the first revision. const revision = await revisions.Item(1); // Get the revision type. const type = await revision.Type; console.log(type); }
ActiveDocument.Revisions.Item(Index).userID
The ID of the reviewer who made the specified revision.
Only IMM WebOffice SDK for JavaScript V1.1.19 and later support this feature.
Syntax
expression.ActiveDocument.Revisions.Item(Index).userID
expression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get all revisions in the document. const revisions = await app.ActiveDocument.Revisions; // Get the specified revision. const revision = await revisions.Item(1); // Get the reviewer's ID. const userID = await revision.userID; console.log(userID); }
RevisionsFilter
ActiveDocument.ActiveWindow.View.RevisionsFilter
The current revision display settings for the document.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.ActiveWindow.View.RevisionsFilterexpression: an Application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the current revision display settings. const RevisionsFilter = await app.ActiveDocument.ActiveWindow.View.RevisionsFilter; }
Properties
ActiveDocument.ActiveWindow.View.RevisionsFilter.View
The document version to display.
Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.ActiveWindow.View.RevisionsFilter.Viewexpression: an Application object.
0 specifies the final version, and 1 specifies the original version.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the current revision display settings. const RevisionsFilter = await app.ActiveDocument.ActiveWindow.View.RevisionsFilter; // Switch to the original document version. RevisionsFilter.View = 1; }