<xlsxRemove> failed



  • I am using JS-Report version 4.5.
    I have excel template that start with:

    {{xlsxRemove "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}
    {{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}

    If I remove the first line it works fine. If not the following error occurs:

    Report "purple-list-to-excel-v3-ltr" render failed.

    "xlsxRemove" helper call failed
    (because) cannot read properties of undefined

    (system-helpers.js line 2891:48)

    2889 | const obj = options.data.root.$xlsxTemplate[filePath]
    2890 | const collection = evalGet(obj, path)

    2891 | options.data.root.$removedItem = collection[index]
    | ^
    2892 | collection.splice(index, 1)
    2893 |
    2894 | return ''

    (system-helpers.js line 3257:17)

    3255 | }
    3256 |

    3257 | return fn.apply(this, arguments)
    | ^
    3258 | }
    3259 | }
    3260 |

    (system-helpers.js line 3284:28)

    3282 | }
    3283 | function xlsxRemove (...args) {

    3284 | return __xlsx.xlsxRemove.call(this, ...args)
    | ^
    3285 | }
    3286 | function xlsxAddImage (...args) {
    3287 | return __xlsx.xlsxAddImage.call(this, ...args)

    TypeError: Cannot read properties of undefined
    at Object.remove (system-helpers.js:2891:48)
    at Object.eval (system-helpers.js:3257:17)
    at Object.xlsxRemove (system-helpers.js:3284:28)
    at Object. (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/executeEngine.js:429:23)
    at Object. (/app/node_modules/@jsreport/jsreport-handlebars/lib/handlebarsEngine.js:87:29)
    at Object.wrapper (/app/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
    at eval (eval at (eval at makeEvaluate (/app/node_modules/@jsreport/ses/index.js:6197:27)), :90:142)
    wrapped by:
    Error: "xlsxRemove" helper call failed
    (because) cannot read properties of undefined
    at module.exports (/app/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
    at WorkerReporter.createError (/app/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)
    at getEnhancedHelperError (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/executeEngine.js:425:54)
    at Object. (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/executeEngine.js:431:15)
    at Object. (/app/node_modules/@jsreport/jsreport-handlebars/lib/handlebarsEngine.js:87:29)
    at Object.wrapper (/app/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
    at eval (eval at (eval at makeEvaluate (/app/node_modules/@jsreport/ses/index.js:6197:27)), :90:142)



  • It seems you are missing index you want to remove here

    {{xlsxRemove "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}
    

    Please share playground demo so we can check whats going on.



  • There's no error in the playgraound. Also I don't get error when I use JSReport version 3.2 on my computer.
    The error occurred for me only in JSReport version 4.5

    Please look at this example I made
    https://playground.jsreport.net/w/anon/7lr4OBqo



  • This doesn't fail for me on 4.5.0. I've tried my local windows instance as well as official docker image.
    Something else might be different on your instance?



  • Thanks


Log in to reply
 

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