docxList tag can not work if I set it in word footer after we Upgrade 3.6.0 to 4.3.1

  • we upgrade our js report server from 3.6 to 4.3.1 at today, then we find a issue, the word template can not work as the error "docxList doesn't match docxContext".
    We use the docxList to generate a list report item in the word template, we set the {{#docxList Projects}} at the beginning, then other tags, then some text with tags, then we set a word footer and set the {{/docxList}} in the footer. We need a word footer to show the text in every page. This template works good before we upgrade report server.
    If I move the {{/docxList}} out of the footer and remove other tags in the footer, the word template can render, but we can not get what we want.
    Could you please help me check what is the issue ?
    0_1711953668363_jsreport error.png

  • administrators

    hi! can you share an export of your template?

    I've tried to replicate that this works on 3.6.2 but i get this error

    0_1711993422675_Screenshot 2024-04-01 at 12 .43.13@2x.jpg

  • Hi, please check this word template, it can render a word in 3.6.0
    [0_1712021629727_Proposal - Copy (1).docx](Uploading 100%)
    0_1712021826789_word template render 1.png

  • administrators

    seem that the upload failed, you can retry again, or send me the file at

  • I have send the word template to your email, please check it. I can not upload this word file as a error message "privileges ".

  • administrators

    thank i have a docx now, i am putting this in my backlog to check, will switch to it as soon as i finish with another task about docx.

  • administrators

    hi, i've tried to reproduce that this was working on 3.6.0 with the docx you sent me via email, but i get the same error i described above Cannot read properties of undefined (reading 'getElementsByTagName')

    are you sure the version in which this works is 3.6.0? how are you installing jsreport? my test was creating a new project with "jsreport": "3.6.0" in package.json and imported this jsreport export 0_1712687918796_export.jsrexport

    it is better if you send me a full export file so we can test the same (you can send me that to bjrmatos@gmail if the upload here gives you issues)

  • I install the jsreport 3.6.0 by the npm install. We have run it years. I have export the word assert, word template and test data. I have send the export file to your email.

    [0_1712717414153_export.jsrexport](Uploading 100%)

  • administrators

    @hexl84 thanks, with the export you send me i no longer get an error and can render normally.

    i will check and investigate how we can let you generate the same output with newer versions of jsreport.

    the problem is that what you were doing with docxList worked just by coincidence, this helper is not expected to be open on the main document and then be closed on a footer, it is prone to errors, it can sometimes work, and sometimes don't, sometimes it will be even skip content of some other XML files, mostly because the order of the internal XML files in docx.

    i think we are still not enforcing that helper calls are opened and closed in the same document, but we may consider it in the future if these kinds of "wrong" usage continue to appear for other users.

  • administrators

    your template can only work with just one item in the array, right? as long as i put another item (to try to produce 2 pages) it produces a corrupted document. does this reflect your usage? were you only using this template always with one item array to produce single-page docx?

  • You are correct, I try to add a second item in the json list, the word can not render. It is ok, we will only render one item with the word template.
    About the word template closed in the footer, do you mean the new version still can not work ? or should I do anything ?

  • administrators

    It is ok, we will only render one item with the word template.

    yes, this is expected, making it works with more than one item is not possible because of Docx limitations, even with MS Word you can not get a different header/footer per page, the header/footer of it is limited to mostly static content, and it allows just dynamic parts for special fields like page count, current page, etc.

    About the word template closed in the footer, do you mean the new version still can not work ? or should I do anything ?

    the new jsreport versions won't work with the same template you have, you need to change it to this:

    0_1713375525335_Screenshot 2024-04-17 at 12 .38.39@2x.jpg

    docxList is opened and closed in the same document, the footer part needs that you make an explicit reference to the data with {{Projects.0.Address1}} for example

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.