Revision

更新时间:
复制 MD 格式

This topic describes the API operations that are related to the Revision object of Word documents.

Revisions

ActiveDocument.Revisions

Obtains 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;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    }

Methods

ActiveDocument.Revisions.AcceptAll()

Accepts all changes 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;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Accept all revisions in the document.
      await revisions.AcceptAll();
    }

ActiveDocument.Revisions.Item()

Obtains the specified Revision object from the Revisions collection of the document.

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 number of the Revision object to obtain.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      // Obtain the Revisions collection.
      const Revisions = await app.ActiveDocument.Revisions;
    
      // Obtain a single Revision object from the Revisions collection.
      await Revisions.Item(1);
    }

ActiveDocument.Revisions.Json()

Obtains 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

    The contents of all revisions in the form of an Array.<Object> that includes items such as [{ user, ... }]. The following table describes the return values.

    Parameter

    Type

    Description

    user

    String

    The username.

    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 content of the revision.

    type

    String

    The revision type.

    date

    Number

    The timestamp that indicates the point in time when the revision was made.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the contents of all revisions.
      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;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Reject all revisions.
      await revisions.RejectAll();
    }

ActiveDocument.Revisions.SwitchRevisionBtn()

Sets whether to show or hide 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. If you specify true, the Accept and Reject buttons are shown. If you specify false, the buttons are hidden.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain 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 visibility by username. The visibility setting takes effect only for the current page. A page refresh invalidates the visibility setting for the page.

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 parameters in the UserInfos array.

    Parameter

    Type

    Required

    Description

    userName

    String

    No

    The username.

    visible

    Boolean

    No

    Specifies whether the revision is visible. Valid values:

    • false (default)

    • true

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Make the revisions invisible.
      await revisions.SetRevisionMarkVisibilityByUserInfo([{ userName: "user01", visible: false }]);
    }

Properties

ActiveDocument.Revisions.Count

Obtains 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;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the total number of revisions.
      const count = await revisions.Count;
      console.log(count);
    }

ActiveDocument.Revisions.RevisionsMode

Shows all revisions in the document in inline mode.

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

Sets 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;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Show revision balloons.
      revisions.ShowRevisionsFrame = true;
    }

Revision

ActiveDocument.Revisions.Item()

Obtains 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 number of the Revision object to obtain.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the first revision in the document.
      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;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the first revision in the document.
      const revision = await revisions.Item(1);
    
      // Accept the first 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;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the first revision in the document.
      const revision = await revisions.Item(1);
    
      // Reject the first revision.
      await revision.Reject();
    }

Properties

ActiveDocument.Revisions.Item(Index).Author

Obtains the name of the user 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 that indicates the name of the reviewer.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the first revision in the document.
      const revision = await revisions.Item(1);
    
      // Obtain the name of the reviewer who made the revision.
      const author = await revision.Author;
      console.log(author);
    }

ActiveDocument.Revisions.Item(Index).Date

Obtains 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).Author

    expression: an Application object.

  • Return value

    A Date object that indicates the date and time when the revision was made.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the first revision in the document.
      const revision = await revisions.Item(1);
    
      // Obtain the date and time when the revision was made.
      const date = await revision.Date;
      console.log(date);
    }

ActiveDocument.Revisions.Item(Index).Range

Obtains 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 that indicates the revision range.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the first revision in the document.
      const revision = await revisions.Item(1);
    
      // Obtain the range of the revision.
      const range = await revision.Range;
      console.log(range);
    }

ActiveDocument.Revisions.Item(Index).Type

Obtains 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 that indicates the revision type. For more information, see WdRevisionType.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
    
      // Obtain the first revision in the document.
      const revision = await revisions.Item(1);
    
      // Obtain the type of the revision.
      const type = await revision.Type;
      console.log(type);
    }

ActiveDocument.Revisions.Item(Index).userID

Obtains 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();
    
      // Obtain all revisions in the document.
      const revisions = await app.ActiveDocument.Revisions;
      
      // Obtain the specified revision.
      const revision = await revisions.Item(1);
    
      // Obtain the ID of the reviewer who made the revision.
      const type = await revision.userID;
      console.log(type);
    }

RevisionsFilter

ActiveDocument.ActiveWindow.View.RevisionsFilter

Obtains the current settings related to the display of revisions in 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;
      
      // Obtain the current settings related to the display of revisions in the document.
      const RevisionsFilter = await app.ActiveDocument.ActiveWindow.View.RevisionsFilter;
    }

Property

ActiveDocument.ActiveWindow.View.RevisionsFilter.View

Sets whether to display the original document version or the final document version.

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;
      
      // Obtain the current settings related to the display of revisions in the document.
      const RevisionsFilter = await app.ActiveDocument.ActiveWindow.View.RevisionsFilter;
      
      // Display the original document version.
      RevisionsFilter.View = 1;
    }