Slides and Layouts

FPresentation manages the slide order and the page size shared by the whole deck. FSlide provides the resolved layout and background of a single slide.

Manage slide order

TypeScript
const presentation = univerAPI.getActivePresentation()if (!presentation) {  throw new Error('No active presentation')}const agenda = presentation.appendSlide({ name: 'Agenda' })const summary = presentation.insertSlide(1, { name: 'Summary' })presentation.moveSlide(summary, 0)presentation.setActiveSlide(agenda)

The current order can be read with getSlides(), getSlideById(), or getSlideByIndex(). deleteSlide() removes a slide through the command pipeline.

Set the page size

TypeScript
presentation.setPageSize({  preset: univerAPI.Enum.SlidePageSizePresetEnum.WideScreen16By9,})

slide.getPageLayout() returns the resolved page size together with the bounds and order of each element. Coordinates use the Slides model coordinate system.

Set a slide background

TypeScript
agenda.setBackground({  type: univerAPI.Enum.SlideBackgroundTypeEnum.Solid,  color: '#1d4ed8',})

Pass undefined to remove an explicitly set slide background. setShowMasterBackground(false) hides the master background graphics inherited by that slide; it does not remove them from the presentation snapshot.

How is this guide?

© 2026 DreamNum Co., Ltd.