For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Add a Subtotal Row to a DOCX Table

Keep subtotal and total rows attached to a DOCX table so they render as one complete table.

Use tableend when you want a subtotal or total to stay attached to a DOCX table.

This pattern helps grouped table content render as one complete table.

It also avoids the extra line break that can appear between separate Word tables.

When to use this

Use this pattern when:

  • a DOCX related list ends with a subtotal row

  • a final total should appear as part of the same table

  • grouped rows should read as one continuous table

Basic pattern

Place a closing tableend block after the main DOCX table.

Insert the subtotal or total table inside that block.

docx-tableend-pattern.txt
[<tableend>]
INSERT TABLE HERE
[</tableend>]

INSERT TABLE HERE should be a Word table.

Match its column widths and formatting to the main table.

How it works

  1. Build your main DOCX table with the normal table syntax.

  2. Add the tableend wrapper after that table.

  3. Insert a one-row table for the subtotal or total.

  4. Add your label and merge field values in that row.

Example use case

Use this when a product table needs a final summary row like Subtotal or Grand Total.

The summary row stays visually connected to the rows above it.

Example:

Tips

  • Keep the subtotal table structure aligned with the main table.

  • Use the same borders and cell padding for a seamless result.

  • Test in Word after upload to confirm the rows appear as one table block.

Last updated

Was this helpful?