Skip to main content
Documents that people correct in Word should behave like the company’s own templates: the style gallery shows the company styles, headings use its colors, and the text shows in its fonts even where they are not installed.

Base document

Point base at a .dotx or .docx made in Word:
The generated document takes from the base:
  • Styles, including the defaults (font, size, spacing) and Word’s built-in styles as the company changed them
  • Theme (colors and fonts that Word’s theme choices refer to)
  • Font table and embedded fonts
  • List numbering definitions
The body, headers and footers of the base are not used; build the letterhead with components. base takes a path, URL or bytes, and goes through the same loadFile as images. It cannot be combined with the styles prop of Document.

Headings and built-in styles

H1 to H6, the table of contents, links and captions use Word’s built-in styles. With a base, they use the base’s version of each style, found by Word’s internal name (“heading 1”). This works whatever language Word was in when the template was made: a Portuguese template calls it Título 1 and the document still uses it. Built-in styles the base lacks are added with the library’s defaults.

Styles by name

styleName applies a style from the base:
The name can be the style’s name as Word shows it, its id or one of its aliases, in any case. An unknown name fails the render with the list of styles of that type, so a typo does not silently produce unstyled text. className still applies on top of the style, like inline formatting in Word. A table style’s header row formatting applies to tables with a Thead. Word gives paragraph styles priority over table styles, so if the base’s Normal style sets a text color, a table style’s text color does not show; set the color in the table style’s paragraph style or leave Normal without one.

Embedded fonts

Each font lists its files per variant: regular, bold, italic, boldItalic. They are stored in the document, obfuscated as Word does, and Word uses them on machines without the font. name must be the family name the text uses.
  • TrueType (.ttf) and OpenType (.otf) files are accepted. Prefer .ttf: Word may not use embedded fonts with PostScript (CFF) outlines
  • Fonts whose license restricts embedding are refused with an error
  • Each file adds its size to the document; embed only the variants in use
LibreOffice also reads embedded fonts. Readers that ignore them substitute a similar font.

Language

Word checks spelling and grammar in the document’s language, and in the given language for passages marked with lang.