var oReq = new XMLHttpRequest();
oReq.open("GET", "/files/1.xlsx", true); // File path
oReq.responseType = "arraybuffer";
oReq.onload = function (oEvent) {
var arrayBuffer = oReq.response;
var blob = new Blob([arrayBuffer]);
websheet.loadFromBlob(blob);
};
oReq.send();
For detailed usage, see: HTML
axios.get('http://www.websheet.cn/files/1.xlsx', { responseType: 'blob' })
.then(response => {
const blob = new Blob([response.data], { type: 'application/octet-stream' });
websheet.loadFromBlob(blob);
})
.catch(error => {
console.error('Failed to load file:', error);
});
For detailed usage, see: VUE Usage
After file loading completes, you can bind methods as follows:
wsheet.$on("DocumentChange", function () {
activeSheet = wsheet.ActiveSheet();
activeSheet.SetCellValue(2, 1, '3435354.34');
console.log("DocumentChange:")
});
Note: You need to reacquire the activeSheet here - the originally initialized activeSheet becomes invalid.
Click any cell in websheet, then right-click to open the context menu. Click to select a local Excel file. As shown:
You can directly use the keyboard shortcut Ctrl+O to quickly open a file.