Docentric Designer Pro Tip: Prepare Multi-Page Report with Page Subtotal

First, as explained in this forum post (Docentric Designer Pro Tip: Prepare Multi-Page Report with Page-Level Totals), we covered how to display running totals per page in a Word template using Docentric.

But now, let’s say we want something a bit different, we want to display the sum total at the end of each page.

If you haven’t followed the steps from the earlier article yet, please do that first. This post builds on that solution and adds a new step to cover this specific case.

The overall logic stays similar, but we’ll slightly change how we use totals.

:brain: So, how can we do this? Let’s break it down step by step:

We still need a counter and a variable for the running total. Both start at zero. As each line prints, we increase the counter by one and add the line amount to our running total.

Then we check if we’ve reached the end of a page. To do this, we use the modulo operator — we divide the current line number by the maximum number of lines allowed on a page. If the result has no remainder, that means we’ve reached the last line on the page.

At that point, we display the total and insert a page break.

But here’s the catch: we also need to reset the running total right after showing it. This way, each page starts with a clean total, and what we get is a separate sum for every page.

This approach gives you a page-by-page breakdown of totals, perfect for long documents where each page needs its own summary.

:magic_wand:Let’s now build this in Docentric Designer

Follow all 8 steps from the previous forum post.

Then just add one more step to reset the running total after each page:

Step 9: Add reset to running totals

After the page break, and still inside the same IF tagging element, insert a new Var tagging element.
Set the Name to runningTotal and the Value to 0 .
This will reset the total so the next page starts fresh.

Now let’s preview the report. Instead of a running total that increases across pages, you should now see the sum total per page displayed at the bottom of each page.

So we are done. Here is also my test template attached for your reference.
page-level-totals.docx (58.9 KB)

1 Like