Slides and Layouts
FPresentation manages slide order and the shared page size. FSlide exposes the resolved page layout and the background of one 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)Use getSlides(), getSlideById(), and getSlideByIndex() to read the current order. 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 plus the bounds and order of its elements. Coordinates use the Slides model coordinate system.
Set a slide background
TypeScript
agenda.setBackground({ type: univerAPI.Enum.SlideBackgroundTypeEnum.Solid, color: '#1d4ed8',})Set undefined to remove an explicit slide background. setShowMasterBackground(false) hides inherited master background graphics for that slide without deleting them from the presentation snapshot.
How is this guide?