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
feat(protocol): add custom sheet template dimensions (#7824)
wpxp123456eb3e64100c14
diff --git a/packages/protocol/src/index.ts b/packages/protocol/src/index.tsindex d585c5ba60..83275e1f23 100644--- a/packages/protocol/src/index.ts+++ b/packages/protocol/src/index.ts@@ -61,6 +61,7 @@ export type {ISnapshot,ITableInfo,} from './ts/univer/snapshot';+export type { ICustomSheetTemplate } from './ts/univer/unit-template';export type { IUnit } from './ts/univer/univer-file';export { CellValueType } from './ts/univer/workbook';export type { ICellData, ISheetBlock, ISheetBlockMeta, IWorkbookMeta, IWorksheetMeta } from './ts/univer/workbook';diff --git a/packages/protocol/src/ts/univer/unit-template.ts b/packages/protocol/src/ts/univer/unit-template.tsindex 57521574ff..6f37123a02 100644--- a/packages/protocol/src/ts/univer/unit-template.ts+++ b/packages/protocol/src/ts/univer/unit-template.ts@@ -22,3 +22,22 @@ export interface ICustomCellTemplate {colWidth: number;showGridlines: number;}++/**+ * Initial worksheet dimensions for the `custom-sheet` template.+ * Each omitted field uses its built-in default independently.+ */+export interface ICustomSheetTemplate {+ /** Initial number of rows. Defaults to 1000. */+ rowCount?: number;+ /** Initial number of columns. Defaults to 20 (A–T); use 26 for A–Z. */+ columnCount?: number;+ /** Default row height in pixels. Defaults to 24. */+ defaultRowHeight?: number;+ /** Default column width in pixels. Defaults to 88. */+ defaultColumnWidth?: number;+ /** Width of the row-number header in pixels. Defaults to 46; an explicit 0 is preserved. */+ rowHeaderWidth?: number;+ /** Height of the column-letter header in pixels. Defaults to 20; an explicit 0 is preserved. */+ columnHeaderHeight?: number;+}diff --git a/packages/protocol/src/ts/univerpro/v1/apply.ts b/packages/protocol/src/ts/univerpro/v1/apply.tsindex 7d1829a71a..92757b281e 100644--- a/packages/protocol/src/ts/univerpro/v1/apply.ts+++ b/packages/protocol/src/ts/univerpro/v1/apply.ts@@ -19,7 +19,7 @@ import type { IError } from '../../univer/constants/errors';import type { UniverType } from '../../univer/constants/univer';import type { IInitialSheet } from '../../univer/initial-sheet';import type { ISnapshot } from '../../univer/snapshot';-import type { ICustomCellTemplate } from '../../univer/unit-template';+import type { ICustomCellTemplate, ICustomSheetTemplate } from '../../univer/unit-template';export interface IForkUnitRequest {sourceUnitId: string;@@ -60,6 +60,7 @@ export interface IWorkbookCreateMeta {customCell?:| ICustomCellTemplate| undefined;+ customSheet?: ICustomSheetTemplate | undefined;/** Other meta in the future. */docContent: string;}diff --git a/packages/protocol/src/ts/universer/v1/snapshot.ts b/packages/protocol/src/ts/universer/v1/snapshot.tsindex f0b5c60d9a..f81ccc18df 100644--- a/packages/protocol/src/ts/universer/v1/snapshot.ts+++ b/packages/protocol/src/ts/universer/v1/snapshot.ts@@ -22,7 +22,7 @@ import type { UniverType } from '../../univer/constants/univer';import type { IInitialSheet } from '../../univer/initial-sheet';import type { IResource } from '../../univer/resource';import type { ISnapshot, ITableInfo } from '../../univer/snapshot';-import type { ICustomCellTemplate } from '../../univer/unit-template';+import type { ICustomCellTemplate, ICustomSheetTemplate } from '../../univer/unit-template';import type { IUnit } from '../../univer/univer-file';import type { ISheetBlock, ISheetBlockMeta } from '../../univer/workbook';@@ -161,6 +161,7 @@ export interface ICreateUnitRequest {snapshot: ISnapshot | undefined;templateID: string;customCell?: ICustomCellTemplate | undefined;+ customSheet?: ICustomSheetTemplate | undefined;initialSheets: IInitialSheet[];docContent: string;preCreateUnitId: string;