Slide Data Structure
ISlideData
ISlideData is the persisted snapshot for one Univer Slides presentation. It stores presentation metadata, the ordered slide collection, optional master and layout layers, transitions, themes, and resources.
Required properties
| Property | Type | Description |
|---|---|---|
id | string | Unique ID of the presentation unit. |
name | string | Display name of the presentation. |
defaultPageSize | ISlidePageSize | Default width and height used when a page has no own size. |
slideOrder | string[] | Slide IDs in presentation order. |
slides | Record<string, ISlidePage> | Normal slide pages keyed by slide ID. |
Optional properties
| Property | Type | Description |
|---|---|---|
rev? | number | Snapshot revision. |
appVersion? | string | Univer version that produced the snapshot. |
locale? | LocaleType | Presentation locale. |
masterPageOrder? | string[] | Master page IDs in stored order. |
masterPages? | Record<string, ISlideMasterPage> | Master pages keyed by ID. |
layoutPageOrder? | string[] | Layout page IDs in stored order. |
layoutPages? | Record<string, ISlideLayoutPage> | Layout pages keyed by ID. |
handoutMasterPageOrder? | string[] | Handout master IDs in stored order. |
handoutMasterPages? | Record<string, ISlideHandoutMasterPage> | Handout masters keyed by ID. |
notesMasterPageOrder? | string[] | Notes master IDs in stored order. |
notesMasterPages? | Record<string, ISlideNotesMasterPage> | Notes masters keyed by ID. |
activeSlideId? | string | ID of the active slide. |
transitionRecords? | Record<string, ISlideTransition> | Reusable transition records keyed by transition ID. |
slideTransitionRefs? | Record<string, string> | Mapping from slide IDs to transition IDs. |
theme? | ISlideThemeData | Default presentation theme. |
themes? | Record<string, ISlideThemeData> | Additional themes keyed by theme ID. |
zoomRatio? | number | Persisted presentation zoom ratio. |
resources? | IResources | Resources contributed by Slides and feature plugins. |
custom? | SlideCustomData | Application-defined presentation metadata. |
Ordered page records
Every ID in slideOrder should resolve to an entry in slides. The optional master, layout, handout-master, and notes-master layers follow the same order-array and keyed-record pattern. activeSlideId, when present, should resolve to an entry in slides.
import type { ISlideData } from '@univerjs-pro/slides'import { PageTypeEnum } from '@univerjs-pro/slides'const slideData: ISlideData = { id: 'deck-1', name: 'Product roadmap', defaultPageSize: { width: 960, height: 540 }, slideOrder: ['slide-1'], slides: { 'slide-1': { id: 'slide-1', name: 'Opening', pageType: PageTypeEnum.Slide, elementOrder: [], elements: {}, }, }, activeSlideId: 'slide-1',}Usage
Pass a snapshot to univerAPI.createPresentation(slideData) to restore a presentation. Use presentation.save() to obtain the current ISlideData snapshot for persistence, export, print, or server-side processing.
Caution
A snapshot is persistence data, not the live SlideModel. After the presentation starts, use Slides Facade methods or registered commands instead of mutating the snapshot object.
How is this guide?