Posted 7 February 2024, 8:22 pm EST
- Updated 7 February 2024, 8:50 pm EST
Hi,
I attempted to reproduce the issue but was unsuccessful. On my end, I was able to utilize the openMode options correctly. Below are snippets and samples demonstrating this. I have provided two samples: one in vanilla JavaScript and another in TypeScript.
To run TypeScript sample, use commands “npm i” → “npm run build” → “npm run serve”.
spread.open(file, () => {
console.log("successfully loaded");
}, (e: any) => {
console.log(e);
}, {openMode:GC.Spread.Sheets.OpenMode.incremental})
Please refer to below some suggestions:
- Make sure to add the package “@grapecity/spread-sheets-io” to your application
- If you are using typescript, you might need to use type “any”.
Refer to the below snippet.
(spread as any).open(file, () => {
console.log("successfully loaded");
}, (e: any) => {
console.log(e);
}, {openMode:GC.Spread.Sheets.OpenMode.incremental})
And in the provided code snippet, you have passed json in success callback but success callback do not receive json.
It is important to note that spread.open() and spread.save() methods are used to open and save the SJS (.sjs) files. These can not be used for importing/export excel(.xlsx) files. To import/export .xlsx files, kindly use spread.import() and spread.export() methods as discussed in our previous reply. Please refer to the demo at https://developer.mescius.com/spreadjs/demos/features/spreadjs-file-format/overview/purejs and below sample.
sample: https://jscodemine.grapecity.com/share/W3Vr_ei0Ek61r1g9ltkhUw/?IsEmbed=false&Theme=Unset&PreviewDirection=0&IsEditorShow=true&IsExplorerShow=true&IsPreviewShow=true&IsConsoleShow=true&IsRunBTNShow=false&IsResetBTNShow=false&IsOpenInCodemineBTNShow=false&PanelWidth=20&PanelWidth=50&PanelWidth=30&defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}
If you encounter any issues despite the above suggestions, it would be helpful if you could provide a sample along with the steps necessary to replicate the behavior. Alternatively, modifying an existing sample to reproduce the issue would also be helpful. This additional information will allow for a more thorough investigation of the problem. Additionally, providing a GIF or video illustrating the issue would further aid in diagnosing the problem.
Regards
Sample.zip