Board Data Structure
IBoardData
IBoardData is the snapshot format used by Univer Boards. It describes one Board unit, including page order, page data, resources, themes, active page, zoom ratio, and board-level settings.
Properties
| Property | Type | Description |
|---|---|---|
| id | string | Unique id of the Board unit. |
| rev? | number | Optional revision value used by persistence or collaboration layers. |
| name | string | Board name. |
| appVersion | string | Version of the package that created the snapshot. |
| locale? | string | Locale of the board. |
| defaultPageSize | IBoardPageSize | Default page size for board pages. |
| pageOrder | string[] | Ordered list of board page ids. |
| pages | Record\<string, IBoardPage\> | Page snapshots keyed by page id. |
| activePageId? | string | Active page id. |
| theme? | IBoardThemeData | Current board theme. |
| themes? | Record\<string, IBoardThemeData\> | Additional named themes. |
| zoomRatio? | number | Current zoom ratio. |
| resources? | IResources | External resources used by images, rich text, tables, and other elements. |
| custom? | `Record<string, unknown> | null` |
| boardSettings? | IBoardSettings | Board-level UI and interaction settings. |
Page data
IBoardPage stores elements by id and uses elementOrder to define rendering order. Keep both structures in sync when constructing a snapshot yourself.
TypeScript
const boardData = { id: 'board-1', name: 'Planning board', appVersion: '1.0.0', defaultPageSize: { width: 1920, height: 1080 }, pageOrder: ['page-1'], pages: { 'page-1': { id: 'page-1', pageType: 'page', name: 'Page 1', elementOrder: ['text-1'], elements: { 'text-1': { id: 'text-1', type: 'text', transform: { left: 120, top: 96, width: 240, height: 80 }, text: 'Kickoff', }, }, }, }, activePageId: 'page-1',}Usage
IBoardData is mainly used to:
- Create a
UniverInstanceType.UNIVER_BOARDunit. - Persist and restore Board documents.
- Prepare data for import, export, or server-side processing.
- Seed a Board with pages, elements, and settings before rendering.
Snapshot objects are persistence data. After a Board is running, prefer Facade APIs instead of mutating the snapshot object directly.
How is this guide?