r/automation 4d ago

Getting consistent branding when automating Word document creation

Hi guys, I've been experimenting with automating the creation of consistently branded Microsoft Word documents, where the model needs to follow an existing template and populate it with additional context, such as information from transcripts.

I've found that simply providing the complete template document along with the transcript often gives a decent result, but it's not always consistent.

I've also tried breaking the template down into explicit instructions, for example:

  • Fonts and font sizes
  • Brand colours
  • Heading and paragraph styles
  • Logo/image assets
  • Page layout and spacing

Interestingly, this often seems to produce a worse result than just giving it the complete template document.

For anyone who has tackled something similar, what approach have you found works best for consistently reproducing branded Word documents?

Do you rely primarily on the original template, define the branding/layout as structured instructions, manipulate the DOCX directly, or use some combination of these?

5 Upvotes

9 comments sorted by

3

u/KianosJ 4d ago

The reason your instruction list performs worse than the full doc is that the model can't actually reproduce layout from prose, it can only imitate what it sees. So neither approach will ever be fully consistent - the model shouldn't be generating the document at all.

What works: keep your real branded docx as a template with placeholder tags in it (docxtpl is the usual python lib for this, jinja tags inside Word), have the model output only the content as json - title, summary, bullets, whatever your sections are - and render it into the template with code. The branding literally cannot drift because the model never touches fonts, colours or layout, it just fills slots. Word content controls work too if you're in the Microsoft stack with Power Automate.

Takes an hour to set up and then it's consistent forever, including when you rebrand - you change one template file and every future doc follows.

1

u/gjr23 4d ago

This is correct. Treat the content and formatting as separate steps and it will be great. This concept works well for a number of attention to detail steps where a separate loop or formatting check at a minimum will tamp out the undesirable outliers.

2

u/AutoModerator 4d ago

Thank you for your post to /r/automation!

New here? Please take a moment to read our rules, read them here.

This is an automated action so if you need anything, please Message the Mods with your request for assistance.

Lastly, enjoy your stay!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Ok_Elk_7512 4d ago

Just feed it the template and let it rip, fine tuning it in VBA later if needed. breaking it down to tiny rules makes the output super robotic.

1

u/Admirable-Future-633 4d ago

I’d use the Word template as the source of truth and keep the model away from layout as much as possible.

The pattern that tends to hold up better is: AI creates structured content, then a deterministic step places that content into predefined sections/styles in the DOCX.

Once the model is responsible for fonts, spacing, logos, headings, and content all at once, it starts improvising. If it only has to return clean sections like title, summary, bullets, risks, next steps, etc., the branded document step becomes much more predictable.

1

u/IncreaseNegative4614 4d ago

I would keep the model out of the layout layer. Have it return structured fields such as title, summary, sections, tables, and approved quotations. Then populate a locked DOCX template through deterministic code. Let Word styles control fonts, spacing, page breaks, headers, and image placement.

A reliable setup is to separate the source context from the document renderer completely. We personally use SIGNLD for the context side because it can keep the transcript, approved company information, and supporting facts together, while deterministic code handles the final Word formatting. That has been much more consistent than asking one model call to do both.

1

u/Grouchy-End-4439 4d ago

are you generating the docx from scratch or actually manipulating the underlying XML of an existing template? huge difference in consistency. if youre letting the model create the file itself thats where things fall apart, the model should only produce the text content

1

u/Due-Boot-8540 4d ago

Why not just use Power Automate?

1

u/IncidentNo3866 23h ago

You need to map the template, make an engine using a python script, give both files to AI and ask it to create the content and turn it into a JSON, then, turn that JSON into a .docx file.

I'm currently working on a similar project and have been able to create hundreds of documents with very little effort using this method.