[]
        
(Showing Draft Content)

GC.Spread.Sheets.Collaboration.Collaboration

Class: Collaboration

Sheets.Collaboration.Collaboration

Table of contents

Constructors

Methods

Constructors

constructor

new Collaboration(workbook)

Represents a collaboration manager that can manage collaboration status.

Parameters

Name Type Description
workbook Workbook The workbook.

Methods

applyChangeSet

applyChangeSet(changeSet): void

Only used in collaboration case, to apply doc's op.

Parameters

Name Type Description
changeSet IChangeSet change set

Returns

void


fromSnapshot

fromSnapshot(snapshot): void

Only used in collaboration case, to restore the snapshot to workbook state.

Parameters

Name Type Description
snapshot Object snapshot object

Returns

void


getPresences

getPresences(): IPresence[]

Get presences for workbook

example

// This example gets presences.
const presences = spread.collaboration.getPresences();

Returns

IPresence[]

presences - The presences info.


getUser

getUser(): IUser

Get user for workbook

example

// this example gets the current user.
const user = spread.collaboration.getUser();

Returns

IUser


onChangeSet

onChangeSet(onOpHandler): void

Only used in collaboration case, to watch change set.

Parameters

Name Type Description
onOpHandler IChangeSetHandler callback to watch change set

Returns

void


registerCollaborationType

registerCollaborationType(type): void

Only used in collaboration case, to register collaboration type.

Parameters

Name Type Description
type IOT_Type collaboration type

Returns

void


setPresences

setPresences(presences): void

Set the presences info.

example

//This example updates the current presences.
let presences = [{
    user: {
        id: '1',
        name: 'User1',
        color: '#FF0000',
        permission: {
            mode: GC.Spread.Sheets.Collaboration.BrowsingMode.edit,
        }
    },
    status: {
        selections: {
             selections: [new GC.Spread.Sheets.Range(0, 0, 1, 1)],
             sheetId: 'sheet1'
        }
    }
}, {
    user: {
        id: '2',
        name: 'User2',
        permission: {
            mode: GC.Spread.Sheets.Collaboration.BrowsingMode.edit,
        }
    },
    status: {
        selections: {
             selections: [new GC.Spread.Sheets.Range(2, 2, 3, 5)],
             sheetId: 'sheet1'
        }
    }
}]
spread.collaboration.setPresences(presences);

Parameters

Name Type Description
presences IPresence[] The presences info.

Returns

void


setUser

setUser(user): void

Sets the current user.

example

//This example sets the current user.
let user = {
    id: '1',
    name: 'User1',
    color: '#FF0000',
    permission: {
        mode: GC.Spread.Sheets.Collaboration.BrowsingMode.edit,
    }
}
spread.collaboration.setUser(user);

Parameters

Name Type Description
user IUser The current user.

Returns

void


toSnapshot

toSnapshot(): Object

Only used in collaboration case, to save workbook state to snapshot.

Returns

Object

snapshot - snapshot object