你好,关于如何在React中引入SpreadJS可以参考附件的demo,另外如果想要在加载表单的时候加载服务器的Excel文件可以参考下面的代码
- var excelIo = new GC.Spread.Excel.IO();
- var excelFilePath = 'resources/Excel/importExcel.xlsx';
- var xhr = new XMLHttpRequest();
- xhr.open('GET', excelFilePath, true);
- xhr.responseType = 'blob';
- xhr.onload = function(e) {
- if (this.status == 200) {
- // get binary data as a response
- var blob = this.response;
- // convert Excel to JSON
- excelIo.open(blob, function (json) {
- var workbookObj = json;
- spread.fromJSON(workbookObj);
- }, function (e) {
- // process error
- alert(e.errorMessage);
- }, {});
- }
- };
-
- xhr.send();
复制代码 更多信息可以参考这篇技术文章
https://gcdn.grapecity.com.cn/fo ... hread&tid=37389
另外,我们有一个新手训练营,您也可以了解一下,有助于学习SpreadJS
https://gcdn.grapecity.com.cn/fo ... peid%26typeid%3D343
|
|