Skip to main content

Module prelude

Module prelude 

Source
Expand description

The handful of types needed to get started with any format, re-exported unprefixed. See the crate-level doc comment for why only these (and not the rest of the API) live here.

Alongside each format’s entry point, its single most basic content-building type is included too (Paragraph for Word, Row for Excel, Slide for PowerPoint) — without at least one of these, prelude::* alone can’t build so much as a “Hello, world!” file, which defeats the point of a prelude. Cell (Excel) is included too: Sheet::write_cell accepts a raw &str/f64/bool directly for the common cases, but reading a workbook back, or writing a formula/date/rich-text cell, still means naming Cell/CellValue explicitly. None of these collide with anything else re-exported here or in another format’s own module.

Structs§

Cell
A single cell (<c>, CT_Cell): a value plus an optional style.
Document
A .docx document: a sequence of block-level content (paragraphs and tables), in reading order, plus an optional default header/footer and a set of named styles (word/styles.xml) paragraphs/runs can refer to.
Paragraph
A paragraph: a sequence of runs, plus paragraph-level formatting.
Presentation
A .pptx presentation: an ordered list of slides, plus the slide size.
Row
A single row of cells (<row>, CT_Row).
ShapeProperties
A shape’s visual properties (<a:spPr>, CT_ShapeProperties): local position/size, geometry, fill, and line. Everything about how a shape looks, independent of where it is anchored in its host document (that part is never modeled here — see the crate-level doc comment).
Slide
A single slide: an ordered list of shapes (<p:spTree>’s children), plus optional speaker notes.
Transform2D
Position, size, rotation, and flipping (<a:xfrm>, CT_Transform2D). Both offset/extent are optional in the schema (a shape can rely entirely on its host anchor for placement, e.g. a picture inside a xdr:twoCellAnchor with no local xfrm at all) — None here means the element itself is either absent or written with only the attributes present, matching that flexibility rather than forcing a fixed size.
Workbook
A .xlsx workbook: a sequence of sheets, in the order they appear in Excel’s own sheet tabs.

Enums§

Color
A color (EG_ColorChoice): the choice DrawingML offers wherever a color is needed (fills, lines, gradient stops..).
Fill
How a shape’s (or a line’s) interior is painted (EG_FillProperties).