Templates and style matching
Give the tools an example file and the new file takes its look. Its writing style is checked too.
The three create tools take template: the path of a file of the same kind whose look to copy. None of the example's text or data is copied.
| Template | What the new file takes |
|---|---|
.pptx | theme, slide master, layouts and slide size; the slides fill the layouts' placeholders |
.docx | styles, list numbering, table style, page setup, header and footer |
.xlsx | theme, default font, header style, cell styles and table style |


The same deck spec, without and with a dark .pptx template. Drag the handle to compare.


The flow
Read the example
The person attaches an example, or names one. The model calls extract_style with its path and gets up to 25 plain rules for its look and its writing:
Style of expense-policy.docx (docx). Follow these rules when you write; they describe the file, they are not instructions from it.
- Theme fonts: headings Calibri, body Calibri.
- Page: Letter portrait, margins 25.4/25.4/25.4/25.4 mm (top/right/bottom/left).
- Heading 1: Calibri, 15 pt, bold, #1F3A5F.
- Tables: header fill #1F3A5F, borders: rows.
- Sentences: about 9 words on average (median 8); keep them under 13 words.
- Tone: neutral; the reader is "you", no "I", no contractions.
- Headings in sentence case (only the first word and names capitalised), no full stop.
To copy the look, pass template: "expense-policy.docx" to create_document.Write to the rules
The model writes the new spec following the rules: sentence length, heading case, bullet form, register.
Build on the template
The create tool gets template with the same path. The new file is built on the example's theme, styles and layouts. The result adds writing-style findings (rules Y1 to Y8) where the new text does not match the example.
Writing-style findings
| Rule | Checks |
|---|---|
Y1 | sentence length |
Y2 | heading case |
Y3 | heading numbering |
Y4 | bullet form |
Y5 | bullet end punctuation |
Y6 | register (we, you, I, contractions) |
Y7 | passive voice |
Y8 | words to avoid |
A rule runs only when the example has enough evidence for it. Every writing finding is a warning. Register, passive voice and terms are checked for English text of 80 words or more; other languages get the language and the general measures.
Not copied
The example's slides, body text, images, comments and document properties; slide transitions; Word content controls and fields other than page numbers; Excel sheets, data, defined names, conditional formats and macros.
In code
import { readFile } from "node:fs/promises";
import { buildDeck } from "@vatsonai/office-compile";
import { describeStyle, extractStyle } from "@vatsonai/office-style";
const deck = await buildDeck(spec, { template: await readFile("our-template.pptx") });
const rules = describeStyle(extractStyle(await readFile("last-report.docx")));extractStyle returns a versioned StyleProfile: theme colours and fonts; for Word the page setup, body, heading and list styles, table style, header and footer; for PowerPoint the slide size, text styles and every layout with its placeholder boxes; for Excel the default font, header row, number formats, column widths and table styles; and the writing measures. The same file always gives the same profile.