/** A run of uniformly-formatted text within a paragraph (PPT-2). */ export interface PptRun { readonly text: string; /** The typeface the run names, resolved through the deck's font collection. */ readonly fontFamily?: string; readonly bold?: boolean; readonly italic?: boolean; readonly underline?: boolean; /** The font size in points, when set on the run. */ readonly sizePt?: number; /** The run colour as 6-hex RGB (no `#`), when an explicit sRGB colour is set. */ readonly colorHex?: string; } /** * One slide paragraph: its runs plus the raw PPT alignment enum (0 left, 1 * center, 2 right, 3 justify, 4 distribute) and indent level (0–4), mapped by the * reader. */ export interface PptParagraph { readonly runs: ReadonlyArray; /** The raw PowerPoint TextAlignmentEnum (mapped to a document-model alignment by the reader). */ readonly align?: number; /** The 0-based outline/indent level. */ readonly level?: number; /** * §2.9.20 — the bullet character this paragraph is marked with, already * translated out of whatever symbol font stated it. Absent when the paragraph * carries none. */ readonly bullet?: string; /** * §2.9.20 `leftMargin` — where the paragraph's BODY sits, in points from the * text box's own left edge. */ readonly leftMarginPt?: number; /** §2.9.20 `indent` — where its FIRST line starts. Left of the body ⇒ hanging. */ readonly indentPt?: number; /** §2.9.32 `lineSpacing`, as a PERCENTAGE of the line's height — 100 is single. */ readonly lineSpacing?: number; /** §2.9.32 `spaceBefore` / `spaceAfter`, in points. */ readonly spaceBeforePt?: number; readonly spaceAfterPt?: number; } /** * An embedded picture referenced by a slide shape — the raw image bytes pulled * from the Pictures stream (PPT-3). */ export interface PptImage { readonly bytes: Uint8Array; /** * §2.3.23 `cropFrom*` — the fraction of each edge of the SOURCE cut away * before it is fitted to the shape's box. Absent ⇒ the whole picture. */ readonly crop?: { readonly left: number; readonly top: number; readonly right: number; readonly bottom: number; }; /** * §2.3.23 `pictureTransparent` — the colour the picture is drawn WITHOUT, * 6-hex and no leading `#`. Clip art of this age states its ground here * rather than carrying an alpha channel. */ readonly transparentHex?: string; } /** A shape's rectangle on the slide, in points (from the OfficeArtClientAnchor). */ export interface PptRect { readonly x: number; readonly y: number; readonly w: number; readonly h: number; } /** * One command of a freeform path (PPT-7), in geometry-bounds space * (`0..pathWidth`, `0..pathHeight`, y down) — the same path-space the DrawingML * custom geometry uses. */ export type PptPathCmd = { readonly kind: 'move'; readonly x: number; readonly y: number; } | { readonly kind: 'line'; readonly x: number; readonly y: number; } | { readonly kind: 'cubic'; readonly x1: number; readonly y1: number; readonly x2: number; readonly y2: number; readonly x: number; readonly y: number; } | { readonly kind: 'close'; }; /** * A shape's exact custom geometry (PPT-7): the freeform path from the OPT's * `pVertices` + `pSegmentInfo` arrays, in its geometry-bounds coordinate space. */ export interface PptCustomGeometry { readonly pathWidth: number; readonly pathHeight: number; readonly commands: ReadonlyArray; } /** * A decorative autoshape (PPT-5): its preset type plus any literal fill / line * colour. Carried only by an anchored shape that has no text and no picture. A * freeform additionally carries its exact custom geometry (PPT-7). */ export interface PptAutoShape { /** The MSOSPT shape type (the FSP `recInstance`). */ readonly shapeType: number; /** The resolved fill colour as 6-hex RGB, when present. */ readonly fillColorHex?: string; /** The resolved line colour as 6-hex RGB, when present. */ readonly lineColorHex?: string; /** * MS-ODRAW §2.3.7.1 — the two-colour sweep a `fillType` of 4..8 asks for. * `fillColor` is one end and `fillBackColor` the other; `fillAngle` is where * it runs. Read as its fillColor alone, 41246-2's title slide came out a flat * teal where every reader fades it to white. */ readonly gradient?: { readonly fromHex: string; readonly toHex: string; readonly angleDeg: number; readonly radial: boolean; /** * §2.3.7.6 `fillFocus` — where along the sweep the FIRST colour peaks, as a * percentage. Zero is a plain ramp; 50 puts it in the middle with the * second colour at both ends, which is a different picture entirely. */ readonly focusPct?: number; }; /** * §2.3.7.1 MSOFILLTYPE 3 — a picture stretched over the shape, its blip named * by `fillBlip`. A `.ppt` table is a group of cell rectangles, and a cell with * a picture background states it exactly this way. */ readonly image?: PptImage; /** §2.3.7.1 MSOFILLTYPE 2 — the picture REPEATS at its own size, not stretched. */ readonly imageTiled?: boolean; /** * §2.3.7.11/.12 `fillWidth` / `fillHeight` — the size one copy occupies, in * points, when the shape states it rather than leaving the tile at the * picture's own size. */ readonly tileSizePt?: { readonly widthPt: number; readonly heightPt: number; }; readonly geometry?: PptCustomGeometry; } /** * One slide shape (PPT-4..5): its text, picture and/or autoshape geometry, plus * its slide rectangle when the shape carries an explicit anchor (else it is laid * out in reading order). */ export interface PptShape { readonly rectPt?: PptRect; /** * §2.3.22 — the shape IS a piece of WordArt: its text is the shape, centred * in its box rather than flowed from the top. Drawn as an autoshape it was a * coloured rectangle where the reference has a word. */ readonly wordArt?: boolean; /** * Whether the shape is a placeholder (§2.9.24). On a MASTER that means it is * a prototype, not decoration: drawn on the slides that follow it, every one * of them would carry "Click to edit Master title style". */ readonly placeholder?: boolean; /** * §2.9.51 `OEPlaceholderAtom.placeholderId` — WHICH placeholder it is. The * three a master keeps for the slide's furniture — 7 the date, 8 the slide * number, 9 the footer — are the only ones whose text does not live in the * shape at all (§2.4.15). */ readonly placeholderId?: number; readonly paragraphs?: ReadonlyArray; readonly image?: PptImage; readonly autoShape?: PptAutoShape; } /** * A slide's background (PPT-12) — the fill on the shape MS-ODRAW marks with * `fBackground`. A `.ppt` states it as a shape like any other; drawn as one it * would be a rectangle among the content, and dropped it leaves a black slide * white. */ export interface PptBackground { /** A solid fill's colour, as 6-hex RGB. */ readonly fillColorHex?: string; /** A shaded fill, in the same terms an autoshape's is (PPT-9). */ readonly gradient?: PptAutoShape['gradient']; /** A picture fill, stretched over the slide (or tiled across it). */ readonly image?: PptImage; readonly imageTiled?: boolean; } /** One slide: its shapes in document order, over its background. */ export interface PptSlide { readonly shapes: ReadonlyArray; readonly background?: PptBackground; } /** The extracted content of a `.ppt`: its slides, deck page size and encryption flag. */ export interface PptContent { readonly slides: ReadonlyArray; /** The deck page size in points, when the DocumentAtom gives a sane slide size. */ readonly slideWidthPt?: number; readonly slideHeightPt?: number; /** Whether the document streams are encrypted/obfuscated (so no text can be read). */ readonly encrypted: boolean; } /** * Walk a `.ppt` (CFB) into its {@link PptContent}: reads the `Current User` * stream for the latest edit (and the encryption token), walks the edit chain to * a persist directory, resolves the DocumentContainer and its slide list, and * reads each slide's shapes/text/pictures. Degrades gracefully — when the * persist/document structure can't be resolved it falls back to scanning the * stream for slide containers directly, and structural doubt yields missing * content, never wrong content. An encrypted file returns no slides with * `encrypted: true`. * * @param bytes The raw `.ppt` (CFB) bytes. * @returns The slides, deck size and encryption flag (empty when not a readable `.ppt`). */ export declare function extractPptContent(bytes: Uint8Array): PptContent; /** The concatenated plain text of a paragraph's runs. */ export declare function paragraphText(p: PptParagraph): string;