Revision

Updated at:

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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Revisions

    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;
    }

Methods

ActiveDocument.Revisions.AcceptAll()

Accepts all revisions in the document.

Important

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.

Important

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.

Important

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.

Important

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.

Important

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

    Value is of type Boolean. Set to true to show the Accept and Reject buttons, or false to 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.

Important

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 UserInfos array.

    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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Revisions.Count

    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 total number of revisions.
      const count = await revisions.Count;
      console.log(count);
    }

ActiveDocument.Revisions.RevisionsMode

The display mode for revisions.

Important

Only IMM WebOffice SDK for JavaScript V1.1.16 and later support this feature.

  • Syntax

    expression.RevisionsMode

    expression: an Application object.

    0 specifies the default mode. 1 specifies 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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ShowRevisionsFrame

    expression: an Application object.

    true specifies that revision balloons are shown, and false specifies 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.

Important

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.

Important

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.

Important

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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Revisions.Item(Index).Author

    expression: an Application object.

  • Return value

    A String with 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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Revisions.Item(Index).Date

    expression: an Application object.

  • Return value

    A Date object 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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Revisions.Item(Index).Range

    expression: an Application object.

  • Return value

    A Range object 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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.Revisions.Item(Index).Type

    expression: an Application object.

  • Return value

    An Enum indicating 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.

Important

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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.ActiveWindow.View.RevisionsFilter

    expression: 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.

Important

Only IMM WebOffice SDK for JavaScript V1.1.10 and later support this feature.

  • Syntax

    expression.ActiveDocument.ActiveWindow.View.RevisionsFilter.View

    expression: 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;
    }