Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
docs(sheet): add snapshot api docs (#3117)
Gpound.liuc99a52c6cd4a
diff --git a/packages/core/src/sheets/workbook.ts b/packages/core/src/sheets/workbook.tsindex 06fd6e820f..3c2f46cc21 100644--- a/packages/core/src/sheets/workbook.ts+++ b/packages/core/src/sheets/workbook.ts@@ -81,6 +81,10 @@ export class Workbook extends UnitModel<IWorkbookData, UniverInstanceType.UNIVERreturn this._name$.getValue();}+ static isIRangeType(range: IRangeType | IRangeType[]): boolean {+ return typeof range === 'string' || 'startRow' in range || 'row' in range;+ }+constructor(workbookData: Partial<IWorkbookData> = {},@ILogService private readonly _logService: ILogService@@ -119,14 +123,21 @@ export class Workbook extends UnitModel<IWorkbookData, UniverInstanceType.UNIVERthis._name$.complete();}+ /**+ * Create a clone of the current snapshot.+ * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.+ * @memberof Workbook+ */save(): IWorkbookData {return Tools.deepClone(this._snapshot);}- static isIRangeType(range: IRangeType | IRangeType[]): boolean {- return typeof range === 'string' || 'startRow' in range || 'row' in range;- }-+ /**+ * Get current snapshot reference.+ * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.+ * @return {*} {IWorkbookData}+ * @memberof Workbook+ */getSnapshot(): IWorkbookData {return this._snapshot;}