community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

BC Word Layout MCP (Part 3): Add totals and page numbers

Adding document totals and page numbers to Word layouts in Business Central using BC Word Layout MCP requires distinguishing between document totals (once after all lines) and group subtotals (once per group). The post explains how to insert non-repeating total rows with proper formatting and real Word page numbers that update automatically.

post BC Captain

Tom Kapitan · 2026-08-24 · 796 words · about 4 min

"The layout prints the amount supplied by the report. It does not calculate discounts, tax, or rounding."

Key points

  • Clarify whether a total requirement means a document total, group subtotal, or line amount, as the distinction affects layout structure and implementation
  • Insert totals as final table rows using insert_table_row with proper cell spanning and formatting, binding to dataset amounts rather than calculating in the layout
  • Add page numbers with insert_page_number as real Word fields, not static text, and verify they appear correctly on all pages including first-page-only footers
  • Test behavior on representative documents (one-page and multi-page) to confirm totals appear once and page numbers follow printed pages

Quotes

  • “The layout prints the amount supplied by the report. It does not calculate discounts, tax, or rounding.” (Clarifies that totals should come from the dataset, not computed in the layout, ensuring correctness and maintainability)
  • “A number inserted into the default footer can be correct and still be invisible on a one-page printout.” (Warns that testing must validate actual print behavior, not just visual design in Word, due to footer variations)

Heads up

  • warning: “The layout prints the amount supplied by the report. It does not calculate discounts, tax, or rounding.”
  • gotcha: “Older Word compatibility settings can cause repeating sections to be lost when someone saves the layout in Word.” (about version 2.0.0)
  • warning: “A number inserted into the default footer can be correct and still be invisible on a one-page printout.”

Context

  • Features: insert_table_row, insert_subtotal_row, set_cell_format, insert_page_number, repeating sections, document totals, page numbering, field binding
  • Versions: v1.1.0, v2.0.0

Source: BC Captain, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.