Merging Table of Contents & Repeating Headers

Hi there,

I am generating two word documents, merging them together, and then converting to PDF through Power Automate (Flow).

  1. When the documents are merged, I want to ensure that the resulting document only has 1 table of contents.

  2. I also want to ensure that my static/constant H1 headings do not repeat along with my template variables.

I had success achieving the above two points once before, but after editing my doc template, I can no longer reproduce the successful results.

Would you have any tips on templating?

My current templates: [Attached]
**the 1.3 doc is what i attempted to avoid merging, this version is closer to the ideal result format. the 1.4 docs are part 1 and part 2 that are meant to be merged to form the final resulting document.
norwich_word_template2_over50_1.4.docx (27.0 KB) norwich_word_template2_wTOC_1.4.docx (27.0 KB) norwich_word_template_1.3.docx (21.9 KB)

My desired result:


Table of contents:
-> Part1 [h1 heading]

  -> h2 heading
    -> h3 heading
 -> h2 heading
    -> h3 heading

-> Part2 [h1 heading]

-> h2 heading
    -> h3 heading
 -> h2 heading
    -> h3 heading

Part 1 contents [doc1]

Part 2 contents [doc2]

Hi @vav,

Could you also share the JSON? I'll try to reproduce the issue and advise on correcting the templates.

Best Regards,
Petr Bushuev
Plumsail Team

Hi @Petr,

Apologies for my delay in responding.

In my power automate flow, I have 2 JSON arrays (1 for Part1, and 1 for Part2). I had experimented with keeping everything in one JSON array, but was not able to get the flow and template to work out as intended that way.

Here is each element in the first JSON array:

Here is each element in the second JSON array:

Attached for convenience are the full populated JSON part 1 and 2.
part2_JSON.json (125.1 KB) part1_JSON.json (83.8 KB)


Hello @vav

  1. Please correct the table of contents according to the article

  2. If you don't want to repeat the H1 heading you need to create a single table cell with transparent borders and put content that you want to repeat inside.

  3. Anyway, If you keep the table of contents in the second document it will appear after the merging. Probably it's possible to avoid merging and combine these 2 templates into one template and then create the resulting docx file?

Best Regards,
Petr Bushuev,
Plumsail team