easy-template-x icon indicating copy to clipboard operation
easy-template-x copied to clipboard

Loop start in headers and closes in body

Open david-randoll opened this issue 1 year ago • 1 comments

Hello,

I'm wondering if it's possible to utilize this library to initiate a tag in the header and conclude it in the footer/body. To provide context, in the attached docx file, I am initiating the "licenses" tag in the header and concluding it in the footer, all while attempting to fill information within the body.

The purpose behind this approach is related to batch report printing. Specifically, certain licenses in the array extend across multiple pages. By placing the license number in the header, we aim to associate them together when a license spans multiple pages.

{
    "licenses": [
        {
            "license_number": "1234",
            "license_information": "This is a license"
        },
        {
            "license_number": "5678",
            "license_information": "This is another license"
        },
        {
            "license_number": "91011",
            "license_information": "This is a third license"
        }
    ]
}

batch report.docx

david-randoll avatar Jan 30 '24 17:01 david-randoll

Hi,

So I looked into it. It would require a little work but it's possible. However, I don't think I'll be getting to this very soon. If you (or anyone else) is interested in implementing this, PRs are always welcome :)

Here are some relevant sources for future reference:

  1. This MS support page explains how to do it in Word.
  2. The programmatic solution involves manipulating the markup of sections and their headers (and footers too, since they need to be handled separately from the headers).

alonrbar avatar Jul 17 '24 10:07 alonrbar