@apertura/pptx
PowerPoint presentation (.pptx) parser - PresentationML
31 exported symbols · 31 declared here · 0 re-exported
Functions
Opens a PowerPoint presentation. Reads the table of contents: slide order and canvas size. Each slide is a separate package part and is therefore parsed on demand: showing the first slide need not touch the other ninety-nine.
Reads `p:cSld/p:bg`: what the slide, layout or master is drawn on. Two spellings. `p:bgPr` states the fill outright; `p:bgRef` names an entry of the theme's background list and the colour to fill its placeholder with, exactly as a shape's `a:fillRef` does — so the same resolution serves both, and the reference is returned as a solid fill of the referenced colour when the theme is not at hand.
Reads `dsp:drawing`: the shapes PowerPoint laid a SmartArt diagram out into. The same tree as a slide's, in Microsoft's own diagram-drawing namespace, so the same reader walks it — which is the whole reason the walker takes a namespace at all.
Reads nine `a:lvlNpPr` out of a list style. The same nine levels appear in four places — the master's `p:txStyles`, a layout placeholder's `a:lstStyle`, the shape's own, and the presentation's default — and a paragraph takes the first answer it finds walking outwards. One reader serves all four.
Parses a slide part (`ppt/slides/slideN.xml`). Shapes nest inside groups (`p:grpSp`), so the walk is recursive. Inheritance from the layout and master is deliberately not resolved here: that is a separate layer which needs access to the whole package, and it belongs to rendering rather than to parsing.
Reads the part into a lookup by style id, braces and all.
Collects all shape text of a slide, for search and previews.
Whether a part draws the master's own shapes. `showMasterSp="0"` on a layout or a slide means "my design, not the one behind me" — 88 parts of the corpus say so, and drawing the master's logo over a layout that turned it off is worse than not drawing it at all.
Which of the master's three lists describes a placeholder's text. Only three kinds of text exist as far as `p:txStyles` is concerned: a title, the body of a slide, and everything else.
Interfaces
A rectangle in EMUs, the DrawingML coordinate system.
A shape holding text or a picture.
A background, and the part whose relationships resolve its picture.
A table on a slide: column widths and rows of cells.
A rule, stated outright or as a reference into the theme's line list.
One part of a table style: the whole table, a band, a header row.
A whole table style: the parts, in the order they override each other. PowerPoint applies them from the least specific to the most: the whole table, then the banding, then the first and last rows and columns. A cell in the header row of a banded table is painted by three of them in turn.
What the master sets for one outline level of one kind of placeholder. `p:txStyles` is the deck's typography: it says a title is 40pt, bold, and coloured `tx2`, and a first-level bullet 20pt in `tx1`. Reading only the size out of it — which is where this started — gives every deck the right scale in the wrong colour.
A paragraph of a text body (`a:p`).
Formatting of a text fragment (`a:rPr`).
A spacing, as a share of the type size or as an absolute measure.
Values
Default slide size: widescreen 16:9, 13.333 by 7.5 inches.
`a:bodyPr` insets when the file states none, in EMUs. A tenth of an inch left and right, a twentieth top and bottom — PowerPoint's defaults, and not zero, so text never touches the edge of its shape.