BC Word Layout MCP (Part 4): Customer statements and work-description lines

A line table is not always the right answer. A customer statement might need a new page for each customer. A quote’s work description might need one paragraph per record, without putting the text inside a table.

In part 3, we distinguished a document total from a group subtotal. Here, the same question comes first: what exactly should repeat?

Updated 25 October 2026: This post originally followed a development build. Use released v2.0.0 with the setup in part 1. It also fixes a nested work-description case that could appear in the local preview but print empty in BC.

Choose the right kind of repetition

Requirement Approach
One table row per quote line A repeating line table.
Details underneath each line A nested detail-row repeater.
A paragraph per work-description record A body repeater around the paragraph.
Each customer’s statement starts on a new page A body repeater over the customer content, with a page break.

The tool for the last two is wrap_in_repeater. It wraps existing body content; it does not build a complete statement or find missing business data for you.

Prepare one customer’s statement first

Export the Word layout for the statement report you intend to use. For an exercise, you can also use the repository’s captured standard statement.

Save it as C:\BCLayoutDemo\Statement.schema.docx. Ask the agent to inspect the customer data item and its available fields.

Start small:

Use BC Word Layout MCP to create C:\BCLayoutDemo\Statement.docx
from Statement.schema.docx.
Start with a blank document headed Customer statement.
Add the customer number from the dataset.
Show me which customer data item and field you used.
Do not add a body repeater yet.

For the captured source, the customer number is /Customer/No_Cust. This is only enough content to test the repeat boundary. A useful statement still needs its addresses, entries, balances, and other required information.

Start each customer on a new page

Once the customer content is correct:

Wrap the existing body of Statement.docx in a repeater over /Customer.
Use wrap_in_repeater with wholeBody true and pageBreakBefore true.
Each customer's content should start on a new page.
Keep its existing field bindings.
Validate the result and preview several customers.

“Start on a new page” is not the same as “fit on one page”. A customer’s statement can still continue over several pages.

Also, do not apply this to every invoice just because it has a top-level header. BC already handles documents per top-level record in normal report processing. Use the wrapper where the layout needs repeated bodies, such as the statement example.

Return to the quote from part 2 and work on a copy.

Inspect the quote dataset for work-description lines.
Add one field-only paragraph for a work-description line after the line table.
Wrap just that paragraph with wrap_in_repeater over its data item.
Print one paragraph per description record, with no forced page breaks.
Do not put the description in a table or repeat the rest of the quote.

For the captured quote, the data item is /Header/WorkDescriptionLines and the field is /Header/WorkDescriptionLines/WorkDescriptionLine.

Keep the paragraph to the field itself. Put a static heading such as “Work description” outside the repeated range, so it prints once rather than before every line.

The released version matters here: v2.0.0 includes the fix for descriptions that looked correct in the mock preview but did not print in BC. Updating the server is safer than trying to repair a development build’s output by hand.

Keep the repeated range small

A body repeater works with body paragraphs and tables. It is not a way to repeat an arbitrary cell or content in a header or footer.

Ask the agent to identify the first and last blocks before wrapping a larger range. Existing section breaks or unrelated repeaters can make the range unsuitable.

If a tool refuses the operation, read the reason and adjust the range or the design. Do not ask the agent to bypass the check with a direct file edit.

To undo a body wrapper without deleting its contents, the agent can use remove_control with keepText: true on the wrapper it created. That does not apply to unwrapping a repeating table row.

Test the documents you will actually print

Run full validation and inspect a preview, then test in a BC sandbox:

  • For statements, select at least two customers and check that their values do not mix.
  • Include one customer whose statement needs more than one page.
  • For work descriptions, try no records, one record, and several records.
  • Check that static headings appear once and descriptions keep their order.

Version 2.0.0 also reports certain invalid repeat structures before upload. That is useful protection, but it does not replace checking the printed business document.

The practical rule is simple: decide the repeat boundary first. Let the agent build it, and then verify the count, content, and page breaks in BC.