Thanks @peter.zhou, got it working with a couple of additional lines of code:
// Include gridjs-spreadsheet CCS styling.
import 'gridjs-spreadsheet/xspreadsheet.css';
// gridjs-spreadsheet requires JSZip to be on the window
window.JSZip = JSZip;
There’s a bug in 23.4.5 which prevents images/charts from being scrolled on certain spreadsheets. This is the console error:
Uncaught TypeError: Cannot read properties of undefined (reading 'left')
at xspreadsheet.js:12:1
at Array.forEach (<anonymous>)
at objectScroll (xspreadsheet.js:12:1)
at xspreadsheet.js:12:1
at Array.forEach (<anonymous>)
at e.value (xspreadsheet.js:12:1)
at i.value (xspreadsheet.js:12:1)
at o.scrollImagesShapes (xspreadsheet.js:12:1)
at xspreadsheet.js:12:1
at e.value (xspreadsheet.js:12:1)
at e.Xo (xspreadsheet.js:12:1)
at a.moveFn (xspreadsheet.js:12:1)
at xspreadsheet.js:12:1
at HTMLDivElement.<anonymous> (xspreadsheet.js:12:1)
This is the object we’re failing on:
{
"type": "image",
"version": "4.6.0",
"originX": "left",
"originY": "top",
"left": 71,
"top": 32,
"width": 54,
"height": 80,
"fill": "rgb(0,0,0)",
"stroke": null,
"strokeWidth": 0,
"strokeDashArray": null,
"strokeLineCap": "butt",
"strokeDashOffset": 0,
"strokeLineJoin": "miter",
"strokeUniform": false,
"strokeMiterLimit": 4,
"scaleX": 1,
"scaleY": 1,
"angle": 0,
"flipX": false,
"flipY": false,
"opacity": 1,
"shadow": null,
"visible": true,
"backgroundColor": "",
"fillRule": "nonzero",
"paintFirst": "fill",
"globalCompositeOperation": "source-over",
"skewX": 0,
"skewY": 0,
"cropX": 0,
"cropY": 0,
"src": "blob:https://localhost:3000/5f1e509d-a824-4504-ba20-20afc0517f91",
"crossOrigin": null,
"filters": []
}
I was able to reproduce the error with the first sheet of this file: Annual reporting suite | Financial disclosures and reporting - NAB