SpreadJS just released v16. How do I open the new file type of .sjs? This is a compressed/zipped file.
I tried creating a javascript Blob and passing this blob to spread.open(). See below.
openFileWithSjs: function (host, sjsFile) {
try {
var blob = new Blob([sjsFile]);
var spread = GC.Spread.Sheets.findControl(host);
spread.open(blob, () => {
console.log("Sjs opened");
}, (e) => {
console.log(e.errorMessage);
});
return "Bidder successfully opened."
}
catch (e) {
console.log(e);
return "Error opening Bidder with ssjson. Error message: " + e;
}
}
I figured this out after reaching out to GrapeCity support.
First, I want to explain what my 'sjsFile' parameter is when it gets passed to my javascript function. sjsFile is a byte array that I get by making an http call in a service class. See below.
Next, I use IJSRuntime to pass the sjsFile parameter to my javascript function.
Finally, I use my sjsFile which is of type byte[] to create a Blob object. Then I pass that object to the spread.open() function. NOTE: You must include the blob options parameter of '{ type: "application/zip" }' when creating your blob. I spent a full day trying to figure out why I couldn't open my blob file when all I needed to do was add '{ type: "application/zip" }'.
I hope this helps with the upgrade to v16 and saves you some time.