Posted 24 February 2023, 5:57 am EST
- Updated 24 February 2023, 6:47 am EST
Hi,
To ensure smooth operation of SpreadJS within a NodeJS environment, a valid license key is required. Additionally, you may come across the “document is not defined” error if a browser environment is not properly mocked. While SpreadJS is not officially supported in NodeJS, you can still use it in this environment by leveraging the “mock-browser” node package.
var mockBrowser = require('mock-browser').mocks.MockBrowser;
global.window = mockBrowser.createWindow();
global.document = window.document;
global.navigator = window.navigator;
global.HTMLCollection = window.HTMLCollection;
global.getComputedStyle = window.getComputedStyle;
global.self = global.window
In the event that you continue to experience issues, we kindly request that you share a working sample that reproduces the issue. This will enable us to investigate further and provide you with targeted assistance. Please refer to the code snippet provided below for further guidance.
Thank you for your cooperation.
Regards,
Avinash