Alloweditranges

Updated at:

This topic describes the API operations related to the AllowEditRanges feature in spreadsheet documents.

Alloweditranges

ActiveWorkbook.ActiveSheet.AllowEditRanges

Obtains the allow edit ranges in the active worksheet of the active workbook.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges

    expression: the document type application object.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      //Obtain the allow edit ranges in the active worksheet.
      const allowEditRanges = await activeSheet.AllowEditRanges;
    }

Methods

ActiveWorkbook.ActiveSheet.AllowEditRanges.Add()

You can use the Add() method to add an allow edit range in the active worksheet.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Add({ Title, Range, Password })

    expression: the document type application object.

  • Parameters

    Parameter

    Data type

    Required

    Description

    Range

    Object

    Yes

    The range.

    Title

    String

    No

    The title.

    Password

    String

    No

    The password of the active worksheet.

  • Example

    async function example() {
      await instance.ready();
    
      const app = instance.Application;
      
      //Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      //Obtain the allow edit ranges in the active worksheet.
      const allowEditRanges = await activeSheet.AllowEditRanges;
    
      //Select the range from the upper-left corner to A1 and the lower-right corner to E20.
      const range = await activeSheet.Range('$A1:$E20');
    
      //Add an allow edit range.
      await allowEditRanges.Add(undefined, range, 'Aliyun');
    }

Properties

ActiveWorkbook.ActiveSheet.AllowEditRanges.Count

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

You can use the Count property to obtain the number of allow edit ranges in a protected worksheet.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Count

    expression: the document type application object.

  • Example

    async function example() {
      await instance.ready();
      const app = instance.Application;
    
      // Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      // Allow edit ranges.
      const allowEditRanges = await activeSheet.AllowEditRanges;
      
      // Number of allow edit ranges.
      const count = await allowEditRanges.Count;
    }

Alloweditrange

ActiveWorkbook.ActiveSheet.AllowEditRanges.Item()

Obtains an item of the allow edit ranges in the active worksheet.

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Item(Index)

    expression: the document type application object.

  • Parameters

    Parameter

    Data type

    Required

    Description

    Index

    Variant

    Yes

    The index of the object.

  • Example

    async function example() {
      await instance.ready();
      const app = instance.Application;
    
      // Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      // Allow edit ranges.
      const allowEditRanges = await activeSheet.AllowEditRanges;
      const item = await allowEditRanges.Item(1);
    }

Methods

ActiveWorkbook.ActiveSheet.AllowEditRanges.Item().Delete()

You can use the Delete() method to delete an item of the allow edit ranges in a protected worksheet.

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Item(Index).Delete()

    expression: the document type application object.

  • Parameters

    Parameter

    Data type

    Required

    Description

    Password

    Variant

    Yes

    The password of the protected worksheet

  • Example

    async function example() {
      await instance.ready();
      const app = instance.Application;
    
      // Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      // Allow edit ranges.
      const allowEditRanges = await activeSheet.AllowEditRanges;
      const item = await allowEditRanges.Item(1);
      await item.Delete('123');
    }

ActiveWorkbook.ActiveSheet.AllowEditRanges.Item().AddUser()

You can use the AddUser() method to add a user to an item of the allow edit ranges in a protected worksheet.

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Item(Index).AddUser()

    expression: the document type application object.

  • Parameters

    Parameter

    Data type

    Required

    Description

    Password

    Variant

    Yes

    The password of the protected worksheet

    UserId

    Variant

    Yes

    The user ID.

  • Example

async function example() {
  await instance.ready();
  const app = instance.Application;

  // Obtain the active worksheet in the active workbook.
  const activeSheet = await app.ActiveWorkbook.ActiveSheet;

  // Allow edit ranges.
  const allowEditRanges = await activeSheet.AllowEditRanges;
  const item = await allowEditRanges.Item(1);

  //Add a user.
  await item.AddUser({Password:'', UserId:'280289376'});
}

ActiveWorkbook.ActiveSheet.AllowEditRanges.Item().RemoveUser()

You can use the RemoveUser() method to remove a user from an item of the allow edit ranges in a protected worksheet.

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Item(Index).RemoveUser()

    expression: the document type application object.

  • Parameters

    Parameter

    Data type

    Required

    Description

    Password

    Variant

    Yes

    The password of the protected worksheet.

    UserId

    Variant

    Yes

    The user ID.

  • Example

    async function example() {
      await instance.ready();
      const app = instance.Application;
    
      // Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      // Allow edit ranges.
      const allowEditRanges = await activeSheet.AllowEditRanges;
      const item = await allowEditRanges.Item(1);
      // Remove a user.
      await item.RemoveUser({Password:'', UserId:'280289376'});
    }

Properties

ActiveWorkbook.ActiveSheet.AllowEditRanges.Item().Range

You can use the Range property to obtain the selection of an item of the allow edit ranges in a protected worksheet.

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Item(Index).Range

    expression: the document type application object.

  • Example

    async function example() {
      await instance.ready();
      const app = instance.Application;
    
      // Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      // Allow edit ranges.
      const allowEditRanges = await activeSheet.AllowEditRanges;
      const item = await allowEditRanges.Item(1);
      await item.Range;
    }

ActiveWorkbook.ActiveSheet.AllowEditRanges.Item().Users

You can use the Users property to obtain the users of an item of the allow edit ranges in a protected worksheet.

Important

Only the SDK for JavaScript V1.1.19 and later support this feature.

  • Syntax

    expression.ActiveWorkbook.ActiveSheet.AllowEditRanges.Item(Index).Users

    expression: the document type application object.

  • Example

    async function example() {
      await instance.ready();
      const app = instance.Application;
    
      // Obtain the active worksheet in the active workbook.
      const activeSheet = await app.ActiveWorkbook.ActiveSheet;
    
      // Allow edit ranges.
      const allowEditRanges = await activeSheet.AllowEditRanges;
      const item = await allowEditRanges.Item(1);
      // Obtain users of the allow edit ranges.
      await item.Users;
    }