BC Word Layout MCP 2.1.0: What changes when you print with a report theme?

In the previous post, I used #0070C0 to make a sales quote heading blue. That’s still the right choice if the heading should always be that blue. But what if it should follow whichever report theme you select in Business Central?

I released BC Word Layout MCP 2.1.0 with support for that distinction. If you haven’t used it before, it’s an open-source, local MCP server that gives agents like Claude Code or GitHub Copilot typed tools to create, edit, validate and preview Word report layouts. The agent doesn’t have to edit the XML inside the .docx by hand.

A theme colour isn’t a fixed colour

Instead of asking for a blue heading, ask for accent1. That’s a slot in the theme, not a particular colour. You can use a theme colour for text, table fills and borders, or give a border a tint such as text2 lighter 40%. The server writes the theme reference alongside the resolved colour, the way Word does, instead of just saving the RGB value.

You can also apply a paragraph style that already exists in the layout, such as Heading1. If the heading still looks the same, check for direct formatting. A font or colour applied directly to the text can hide what the style specifies. set_text_format can clear that formatting so the style takes over.

Before the release, I printed the whole test pack, all 32 layouts, in a BC 29 sandbox. Theme colours, their tints and theme fonts followed the report theme. Fixed colours and explicitly named fonts stayed as they were. So use a theme colour for a heading that should follow the selected branding, but keep a fixed colour for a line that must always print the same way.

Which theme is the layout using?

The new set_layout_theme tool edits the theme inside the layout itself. You can change the colour slots and the theme’s heading and body fonts. It doesn’t edit a separate report theme (.dotx).

The stock themable Blue invoice is a good example. Its own accent1 is coral (F24F4F). Set that slot to 0070C0 and the parts using accent1 turn blue when you print without a report theme. Select a report theme in BC and those same parts follow the selected theme instead. The layout’s own theme is what you get when no report theme is selected.

What about footers and merged cells?

If you want “Continued on the next page” in a footer, you don’t want it on the last page (or on a one-page invoice). The new insert_page_conditional_text tool uses a Word IF field with PAGE and NUMPAGES. You can choose notLastPage for the continuation notice, lastPage for a line that belongs at the end, or firstPage for text that should appear only at the start. This is for static text, not a dataset field. All three conditions worked on both one- and two-page orders in the BC 29 sandbox.

The table tools can also work with vertically merged cells. Microsoft’s BC 29 header/footer designs use these for the report caption, which spans several rows. Instead of refusing the whole table, the server can now change column widths while preserving the merge. To edit the caption, target the cell where the merge starts, not one of the cells below it.

Check the target before you edit

Installing MCP 2.1.0 doesn’t make an extension target BC 29. The server reads application from the nearest AL app.json above the layout. If you’re working outside an AL project, you can set BCWL_BC_VERSION in the server configuration. You can see the resolved target in get_layout_info or validate_layout.

The server refuses new theme-colour and paragraph-style edits, and calls to set_layout_theme, if the target is below BC 29 or unknown. A fixed hex colour doesn’t need BC 29. If you’re working on a layout exported to a separate folder, check the reported target before assuming the tool can’t make the change.

If you pinned the package in the original setup, change it to BcWordLayout.Mcp@2.1.0 and restart the server. The installation guide also covers the Claude Code and VS Code plugins and running from NuGet with dnx.

For your first test, print the same document in your sandbox with and without a report theme. That makes it much easier to spot which parts follow the theme and which are still using fixed formatting. If the result isn’t what you expected, open an issue on GitHub and include the BC version and what you expected to print.