[]
Sheets.Collaboration.Collaboration
• new Collaboration(workbook
)
Represents a collaboration manager that can manage collaboration status.
Name | Type | Description |
---|---|---|
workbook |
Workbook |
The workbook. |
▸ applyChangeSet(changeSet
): void
Only used in collaboration case, to apply doc's op.
Name | Type | Description |
---|---|---|
changeSet |
IChangeSet |
change set |
void
▸ fromSnapshot(snapshot
): void
Only used in collaboration case, to restore the snapshot to workbook state.
Name | Type | Description |
---|---|---|
snapshot |
Object |
snapshot object |
void
▸ getPresences(): IPresence
[]
Get presences for workbook
example
// This example gets presences.
const presences = spread.collaboration.getPresences();
presences - The presences info.
▸ getUser(): IUser
Get user for workbook
example
// this example gets the current user.
const user = spread.collaboration.getUser();
▸ onChangeSet(onOpHandler
): void
Only used in collaboration case, to watch change set.
Name | Type | Description |
---|---|---|
onOpHandler |
IChangeSetHandler |
callback to watch change set |
void
▸ registerCollaborationType(type
): void
Only used in collaboration case, to register collaboration type.
Name | Type | Description |
---|---|---|
type |
IOT_Type |
collaboration type |
void
▸ 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);
Name | Type | Description |
---|---|---|
presences |
IPresence [] |
The presences info. |
void
▸ 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);
Name | Type | Description |
---|---|---|
user |
IUser |
The current user. |
void
▸ toSnapshot(): Object
Only used in collaboration case, to save workbook state to snapshot.
Object
snapshot - snapshot object