Access Ressources from Helper Functions of docx

  • Hi there

    I'm currently developing a Report with Docx as the Template Recipe, that I want to be Localized.

    Accessing the ressource Data in the docx itself works as expected. However when trying to access the local ressource in the Helper with this I get an undefined Error.

    When looking at the logs it looks to me as if the resource data is not copied from the Main render process to this sub Process where apparently the Helper functions get rendered

    Ps: not really sure on which version of jsReport I currently am how can I check this? as this seems important information to me.

    Console Output :

    2021-10-11T08:21:35.640Z - info: Starting rendering request 217 (user: null)
    2021-10-11T08:21:35.641Z - info: Rendering template { name: DocxTest, recipe: docx, engine: handlebars, preview: true }
    2021-10-11T08:21:35.644Z - debug: Adding sample data eIdvbN9ACS
    2021-10-11T08:21:35.645Z - debug: Found 1 resources for language "de"  <-------
    2021-10-11T08:21:35.645Z - debug: Base url not specified, skipping its injection.
    2021-10-11T08:21:35.646Z - debug: Rendering engine handlebars using http-server strategy
    2021-10-11T08:21:35.651Z - debug: Taking compiled template from engine cache
    2021-10-11T08:21:35.652Z - debug: Executing recipe docx
    2021-10-11T08:21:35.652Z - info: docx generation is starting
    2021-10-11T08:21:35.755Z - debug: Starting child request to render docx dynamic parts
    2021-10-11T08:21:35.756Z - info: Starting rendering request 218 (user: null)
    2021-10-11T08:21:35.756Z - info: Rendering anonymous template { recipe: html, engine: handlebars }
    2021-10-11T08:21:35.757Z - debug: Inline data specified.
    2021-10-11T08:21:35.757Z - debug: Resources not defined for this template.    <-----
    2021-10-11T08:21:35.757Z - debug: Base url not specified, skipping its injection.
    2021-10-11T08:21:35.759Z - debug: Rendering engine handlebars using http-server strategy
    2021-10-11T08:21:35.771Z - debug: Taking compiled template from engine cache
    2021-10-11T08:21:35.772Z - debug: this:                
    2021-10-11T08:21:35.772Z - debug: { test: 'this is a test' }   <------ print of this object
    2021-10-11T08:21:35.776Z - debug: Executing recipe html
    2021-10-11T08:21:35.776Z - info: Rendering request 218 finished in 20 ms
    2021-10-11T08:21:35.776Z - debug: Skipping storing report.
    2021-10-11T08:21:35.892Z - debug: docx successfully zipped
    2021-10-11T08:21:35.892Z - info: docx generation was finished

  • Yes, this looks like a bug. Thank you for pointing it out.
    I will post here info about the fix.

  • @jan_blaha do you need any further information like jsreport version or similair?
    Also I suppose since you're now aware of it I don't need to report a github issue, right?

  • I have tested this and it seems to work for me properly. Could you look at this export and test it?
    I use jsreport 2.11.

    0_1633974017985_export (88).zip

  • @jan_blaha How can I add those Files to my JsReport Instance? I tried by copying them on the FileSystem but I got only empty folders in the studio. Do I need to use OData?

Log in to reply

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