Skip to content
Presentation

Presentation

A presentation is a stack of slides, and each slide is created from a layout rather than from nothing. The layout belongs to a slide master and determines which placeholders the slide starts with, so AddSlide is really “add a slide of this kind”. presentation.New() builds a deck with one master, one blank layout and a 16:9 slide size, and every AddSlide call attaches the new slide to that blank layout.

That makes templates the normal way to work. A designer produces a .pptx with masters and layouts already right, OpenTemplate reads it, GetLayoutByName picks the layout you want and AddDefaultSlideWithLayout gives you a slide carrying that layout’s placeholders. Building a deck from New() is possible and is what the first two guides do, but you inherit responsibility for the appearance of everything on the slide.

Content sits in shapes. A text box is a shape holding paragraphs and runs, structured much like a Word paragraph; tables and images are shapes too, and placeholders are shapes the layout already put there. Which wrapper you get depends on how the shape arrived: AddTextBox returns a TextBox, GetTextBoxes finds the ones flagged as text boxes, and PlaceHolders finds the ones the layout supplied. A placeholder is not a text box and will not turn up in GetTextBoxes.

Position is absolute. Nothing on a slide flows or reflows, so every shape carries an offset and an extent measured from the top left corner of the slide, in measurement units. Changing the slide size afterwards does not move anything.

Where to look

GuideCovers
Simple PresentationBuilding a deck from scratch, shapes and text on a slide.
Styled Shapes and BulletsShape geometry, fills, text anchoring and bullet levels.
Slide SizeThe three size presets and custom dimensions.
Text BoxesReading and editing text in an existing deck, adding a new box.
TablesBuilding a table on a slide and styling it.
ImagesRegistering a picture and placing it, sizing without distortion.
ChartsRendering a chart and putting it on a slide as a picture.
Copy and Reorder SlidesCopying a slide between decks and moving it into position.
Use a TemplatePicking a layout by name and filling its placeholders.
Template with an ImageFilling a picture placeholder from a local file.
Fill a Template from DataGenerating one deck per record from JSON.
Table into a PlaceholderReplacing a table placeholder with a real table.
Text ExtractionReading text back out, with run and table metadata.
Image ExtractionPulling the pictures out of a deck.
Convert to PDFRendering slides to PDF pages.
Last updated on