/bc-word-layout:al-word-layout-from-designfrom BC Word Layout
Converts a finished Word design (styled .docx with sample values) into a data-bound Business Central Word layout. Guides a functional consultant through mapping sample text to dataset fields, building the bound layout, and verifying it.
Ships in BC Word Layout. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Scenario. A consultant (or a designer working for one) has made the document in Word the way the customer wants it — colours, fonts, a logo box, a line table with sample rows, totals — and the BC report already exists (a standard report such as 1306 Standard Sales - Invoice, or a custom one). They should not need to know OOXML, XPath or AL. The agent turns the design into a layout BC can print; the consultant answers questions about meaning ("is PO-5521 the customer's order number?") and uploads the result.
al-word-layout-design answers "what should a new layout look like". This skill answers "the look is
decided — make it print real data". Read al-word-layout for the tool mechanics; everything below
uses those tools by name.
Evidence tags as in the sibling skills:
al-word-layout-composite).validate_layout level=full + preview_layout.Ask only for what is missing, in plain words:
| Input | Why | How the consultant gets it |
|---|---|---|
The report's empty layout (.docx) | It carries the BC dataset part — the list of every field the report offers. Never synthesized (al-word-layout §1). | In Business Central: Report Layouts → pick the report → create a new Word layout → export it. An exported standard layout of the same report works as well. |
The design (.docx) | The look to keep. | Their Word file. It must not already be a BC layout (no bound fields). |
| Which report | Picks the dataset. | Usually obvious from the empty layout (get_layout_info → report). |
Tips worth passing on to whoever makes designs, so the next one converts cleanly:
list_dataset_fields on the empty layout: the data items (Header, Header/Line,
Header/Totals, …), their columns, and which columns are labels (isLabel).word/document.xml text with table/row/cell
breaks is enough. Also note what is design, not data: colours, shading, borders, fonts, sizes.This is the step no tool can do, and the one that decides whether the layout is right. Build a table with one row per text item in the design:
| Design text | Kind | Binds to | Note |
|---|---|---|---|
INVOICE | label | /Header/DocumentTitle_Lbl | caps come from formatting |
No. / 2026-0142 | label + field | /Header/DocumentNo_Lbl, /Header/DocumentNo | |
PO-5521 | field | /Header/ExternalDocumentNo | customer's own reference — confirm |
Payment information | static | — | no label column exists: not translated |
Payment is due within 15 days… | drop | — | states terms as fixed text; would print wrong |
Kinds: field (data), label (a caption the dataset provides — always bind it rather than typing it, so it translates), static (no dataset column; stays literal and is NOT translated — say so), drop (sample text that would print false information), picture (logo → a picture control).
Show the table to the consultant in plain language and get a yes, or corrections, before building — one round. Ask only about real ambiguities; decide the rest with the rules below and list them.
…_Lbl / Labels column whenever one exists; static text only when none
does. Expect a few static captions (section headings such as "Details", "Notes")./Header/CompanyAddress1…8 are BC's formatted address lines and line 1 is the
name; VAT and registration numbers each have a value and a _Lbl column. Lines a company does not
use print empty — there is no hide-if-empty tool (al-word-layout §3).CustomerAddress1…8 (bill-to), ShipToAddress1…8; line 1 is the name.
Reserve as many lines as the design shows; say that a contact or second name line needs a 5th.ExternalDocumentNo; BC's own order number is
OrderNo. "Delivery date" on an invoice is ShipmentDate. When in doubt, ask.ItemNo_Line, Description_Line,
UnitOfMeasure, Quantity_Line, UnitPrice, LineAmount_Line, captions from the line's _Lbl
columns. A running line counter ("1, 2, 3") does not exist in the dataset (LineNo_Line is 10000,
20000…) — offer the item number instead, or drop the column.Totals data item, not from line sums: subtotal, invoice discount, the
VAT text field (it carries the rate, so "VAT 20%" is never hard-coded), grand total text + amount,
CurrencyCode.WorkDescriptionLines/WorkDescriptionLine repeated per line. Boilerplate promises (due
dates, "valid without stamp") are dropped or replaced by a neutral sentence — confirm with the consultant./Header/CompanyPicture in 1306).The design's look is already in its file, so the layout starts from the design's own package instead
of being rebuilt: the formatting tools (format, set_text_format, set_cell_format) could
re-create a look, but keeping the original is cheaper and exact. What no tool does is turn sample text
into a bound field in place: insert_field with locationType="atText" appends the field at the end
of the paragraph that holds the match, not where the match is, and nothing deletes plain text outside a
table cell. So the binding is a deliberate, validated package edit, exactly the route al-word-layout §4
reserves for "what genuinely has no tool". Keep it mechanical:
Copy the design .docx; keep its styles, fonts, footer and section setup; remove review leftovers
(comments, tracked changes). Give it the dataset part one of two ways:
create_layout with schemaSource = the empty layout and templatePath = the design: it ships one
dataset part with a fresh storeItemID and the glossary part, and keeps the design's body, headers,
footers, styles and settings as they are. It does not set the compatibility mode: check that the
design's settings.xml declares compatibilityMode 15 (validate_layout warns once the layout holds a
repeater and it does not). Read the storeItemId back with get_layout_info. [verified: sandbox pack
item P17, which printed with the template's headers and footers]customXml/item*.xml (the urn:microsoft-dynamics-nav/reports/… part)
into the package with an itemProps part declaring a new storeItemID, and set
compatibilityMode 15 in settings.xml. [verified]Per the confirmed map, replace the run holding the sample text with a run-level plain-text content
control, copying the run's w:rPr into both the w:sdtPr and the inner run so the look is unchanged:
<w:sdt><w:sdtPr><w:rPr>…same as the sample run…</w:rPr>
<w:alias w:val="#Nav: /Header/DocumentNo"/><w:tag w:val="#Nav: Standard_Sales_Invoice/1306"/><w:id w:val="…unique…"/>
<w:dataBinding w:prefixMappings="xmlns:ns0='urn:microsoft-dynamics-nav/reports/Standard_Sales_Invoice/1306/' "
w:xpath="/ns0:NavWordReportXmlPart[1]/ns0:Header[1]/ns0:DocumentNo[1]" w:storeItemID="{…}"/>
<w:text/></w:sdtPr>
<w:sdtContent><w:r><w:rPr>…same…</w:rPr><w:t>DocumentNo</w:t></w:r></w:sdtContent></w:sdt>
"No. ", ": ", " · ")._Lbl column. Static captions stay plain runs.w:alias = the column name and w:tag =
#BC:InsertDataItem,DataItems/Header/DocumentNo. Microsoft's own sample bodies mix both; the #BC
form is the one printed here [verified]. The binding is what BC reads — pick one convention per file.w:picture in w:sdtPr, a w:drawing with a placeholder image
inside, bound to the picture column) — the same shape insert_picture writes.Keep the header row (bind its captions) and the first sample row; delete the other sample rows;
bind the kept row's cells; wrap that row in a row-level repeater over the line item — the shape
insert_repeater_table produces:
<w:sdt><w:sdtPr><w:alias w:val="#Nav: /Header/Line"/><w:tag w:val="…"/><w:id w:val="…"/>
<w15:dataBinding w:prefixMappings="…" w:xpath="/ns0:NavWordReportXmlPart[1]/ns0:Header[1]/ns0:Line" w:storeItemID="{…}"/>
<w15:repeatingSection/></w:sdtPr>
<w:sdtContent><w:sdt><w:sdtPr><w:id w:val="…"/><w15:repeatingSectionItem/></w:sdtPr>
<w:sdtContent><w:tr>…the bound row…</w:tr></w:sdtContent></w:sdt></w:sdtContent></w:sdt>
Mark the header row w:tblHeader so it repeats on every page. Alternating row shading in the design
cannot survive (one template row repeats): drop it, or move it into a table style's band2Horz and
set the table's w:tblLook (§5).
Bind straight to /Header[1]/…: BC already prints the body once per document. A block repeater over
/Header without a w:group prints an EMPTY page (validate_layout's top-level-repeater-group);
when one is really wanted, wrap_in_repeater writes the correct shape. Block repeaters over nested
items (work-description lines) need no group, and hold their field as a block-level control around
the paragraph, as the stock quote does; wrap_in_repeater turns a paragraph holding only the field
into that shape. BC 28 prints nothing for a paragraph with the field inline in it (sandbox pack P14 and
P18), so do not hand-wrap that form.
Once the package is bound and validates, change its look with typed calls, not more hand edits:
set_text_format restyles text that is already there: a control by id (including the control's own
w:sdtPr/w:rPr, which BC formats the bound value with), a table cell, a whole row, or one exact
piece of text. It takes the format object (bold, italic, underline, fontSizePoints,
fontName, color, characterStyle) and an optional alignment.set_cell_format sets cell rules (edges) and a cell fill.format only to differ from it.validate_layout level=full — 0 errors; every binding resolves.preview_layout, then render_preview_pages with outputDir so the consultant can open the pages.
Use sampleRows ≥ 20 once, to see the line table break across pages with its header repeated.Mock-render traps met on this route (not layout bugs):
w:tblLook w:val; keep it consistent with the
firstRow/lastRow/noHBand attributes (0x20 first row, 0x40 last row, 0x200 no banding,
0x400 no vertical banding) or header/total-row formatting silently disappears in the preview.Normal) and keep the base text
colour in docDefaults.Send the consultant the layout plus the preview pages, and say in plain words:
When the customer wants the same look across many reports — a shared header/footer and theme — split
the result into a composable layout: al-word-layout-composite.
No such tool exists yet — do not try to call one. Everything in §4.2 would be a single typed call with
a tool that replaces matched sample text with a bound field or label control, inheriting the run's
formatting (proposed working name: replace text with field: layout path, search text, dataset path),
plus a row variant that turns a sample table row into a repeater row and deletes its sibling sample
rows. set_text_format's text target already does the hard part: it finds the text, splits it out of
its run with the run's formatting kept, and refuses text inside a data-bound control. The new tool
should share that contract. One open question: set_text_format refuses text that occurs more than
once, but a design can repeat a sample value with nothing around it to tell the two apart, so the new
tool may need an occurrence argument; if it gets one, set_text_format should get the same. Until
the tool exists, the package edit above is the route — always followed by validate_layout level=full.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub tkapitan/bc-word-layout-mcp --plugin bc-word-layout4 skills in this plugin
/al-word-layoutUse whenever inspecting, creating, editing, validating, or previewing a Business Central Word report layout (.docx) — BC Word layouts, report layouts, and their bound content controls (fields, labels, repeater tables) — through the bc-word-layout MCP tools, instead of hand-editing the underlying OOXML directly. Covers the inspect → edit → validate → preview workflow, the exact tool surface and parameters, what the tools do and do not support, and the error envelope every tool returns./al-word-layout-compositeUse when building, splitting or debugging a Business Central composable (composite) Word layout - a report BODY, a reusable HEADER/FOOTER layout and a report THEME (.dotx) that BC combines at print time. Covers what each of the three files must and must not contain, the style contract between theme and body, splitting one designed document into the three parts, the checks to run, and why a theme can fail to restyle a body. Complements al-word-layout (tool mechanics) and al-word-layout-from-design (binding a finished design)./al-word-layout-designUse when designing a NEW Business Central Word report layout (or re-shaping an existing document) — deciding what the document should look like before any edit tool is called. Covers the two archetype skeletons (trading document, list/analysis report), the observed BC design conventions (address blocks, caption placement, line-table alignment, borders, totals, header/footer chrome, typography), the BC-verified tool recipe for each block, and the stock idioms the tools cannot build. Complements al-word-layout, which covers the tool mechanics, workflow, and error envelope — that skill is HOW to call the tools; this one is WHAT to build.Other plugins' skills for the same job