Skip to Content
Vatson Office

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.

TemplateWhat the new file takes
.pptxtheme, slide master, layouts and slide size; the slides fill the layouts' placeholders
.docxstyles, list numbering, table style, page setup, header and footer
.xlsxtheme, default font, header style, cell styles and table style
The same slide built on a dark template: navy master with an amber bar, serif title, amber dash bullets, the template's footer
Slide built with the default theme: white background, green heading rule, round bullets
Default themeDark .pptx template

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

A document built with the default styles
Document, default styles
The same document built on a template with other heading fonts and colours
The same spec on a .docx template

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

RuleChecks
Y1sentence length
Y2heading case
Y3heading numbering
Y4bullet form
Y5bullet end punctuation
Y6register (we, you, I, contractions)
Y7passive voice
Y8words 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.

On this page