Hi
I have used this https://wisej.com/support/question/wisej-integrated-with-componentone-spreadjs, as my starting point and was able to get the SpreadJS working in the Page. I have been testing and on the same page got some buttons to test the Tabs (show/hide), from C# push data into Cells, these are working fine.
I have been trying to load as excel file from C# but not working. I have place console.log(…) to log any errors and the steps.
So far no exceptions.
I have attached my test project and I have provided a sample excel file in the project/files folder.
in the Tools.cs page, I read file as Byte[], the convert to Base64 and pass that through. No Luck
I have tried to pass the Byte[] array as well. Does not work.
If someone can help me resolve this, i would be greatly appreciative.
private async void button3_Click(object sender, EventArgs e) { try { // Read File //Convert to Base64 byte[] ofile = File.ReadAllBytes(@"C:\Work_Offline\TestWB_Nancy.xlsx"); string toB64 = Convert.ToBase64String(ofile); await this.widget1.CallAsync("LoadXL", toB64); // Console.WriteLine(result); //textBox1.Text = result; } catch { Console.WriteLine("Error found in Javascript. - Results returned was null"); } } Thanks Guys Paresh. ps. Apologize for the mis-aligned code formatting.
I briefly looked at your sample and at the SpreadJS documentation. One potential issue that I see is that you might need to reference the “excel.io” script. You can do this in the designer under “Packages”. You can either reference a script in the file directory (like your other scripts) or reference it from a cdn. I couldn’t find a cdn for it, so it’s probably best to download the script and reference it in the file directory.
Also a note on debugging, in case you don’t already know- if you press F12 to open developer tools, and click on the “Sources” tab, you can see the javascript that is being run. You can even set breakpoints in the javascript, and hover over variables to see their values. This is quite helpful- I was able to set a breakpoint in the “LoadXL” function on line 129, so I can verify that it is in fact being called when you click the button. See screenshot.
For further assistance, you’ll need to refer to the SpreadJS documentation, as this is really a SpreadJS issue and not a Wisej issue.
Relevant SpreadJS documentation:
https://developer.mescius.com/spreadjs/docs/getstarted/quick-start/importing-files
https://developer.mescius.com/spreadjs/docs/excelimpexp/excelclient
Please login first to submit.