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
| Guide | Covers |
|---|---|
| Simple Presentation | Building a deck from scratch, shapes and text on a slide. |
| Styled Shapes and Bullets | Shape geometry, fills, text anchoring and bullet levels. |
| Slide Size | The three size presets and custom dimensions. |
| Text Boxes | Reading and editing text in an existing deck, adding a new box. |
| Tables | Building a table on a slide and styling it. |
| Images | Registering a picture and placing it, sizing without distortion. |
| Charts | Rendering a chart and putting it on a slide as a picture. |
| Copy and Reorder Slides | Copying a slide between decks and moving it into position. |
| Use a Template | Picking a layout by name and filling its placeholders. |
| Template with an Image | Filling a picture placeholder from a local file. |
| Fill a Template from Data | Generating one deck per record from JSON. |
| Table into a Placeholder | Replacing a table placeholder with a real table. |
| Text Extraction | Reading text back out, with run and table metadata. |
| Image Extraction | Pulling the pictures out of a deck. |
| Convert to PDF | Rendering slides to PDF pages. |