Word styles as an API
Read a document's theme and named styles, edit them, and write paragraph and character styles back.

A firm's own documents already define its house style: the theme, the document defaults, and named styles such as Normal, Heading 1, and Clause Quote. If your code can only set bold or font size on each run, every paragraph carries its own copy of that formatting, and a change to the house style means touching every paragraph again.
SuperDoc can now read a document's styles into an editable style guide and write named styles back.
Read the theme
styles.getTheme() returns the theme on its own: the color scheme as six-digit hex values, the major and minor fonts,
and the color mapping from word/settings.xml.
const theme = await doc.styles.getTheme();Create a named style
styles.create defines or redefines a paragraph or character style in the document's style definitions. Values use
the units Word stores: half-points for font size and twentieths of a point for spacing.
await doc.styles.create({
id: 'ClauseQuote',
name: 'Clause Quote',
type: 'paragraph',
basedOn: 'Normal',
qFormat: true,
paragraph: { spacing: { before: 120, after: 120 } },
run: { italic: true, color: { themeColor: 'accent2' } },
});A character style takes run properties only. With conflictPolicy: 'replace', the input replaces the whole
definition, so a property you leave out is removed. Send every property the style should keep.
Extract and reuse a style guide
The style guide workflow in the docs runs end to end with the Node SDK. It reads the theme, document defaults, and styles
into a guide, writes the edits back with styles.apply for the defaults and styles.create for each style, and
applies the result to a new draft as a template. Nothing in it unzips the DOCX or parses XML.
Limits
styles.create writes paragraph and character styles only. It cannot redefine half of a linked pair, such as
Heading 1 and Heading 1 Char, and it does not write table styles.