loadExcel(args: Event) {
let request: XMLHttpRequest = new XMLHttpRequest();
request.responseType = "blob";
request.onload = () => {
let file: File = new File([request.response], (args.target as HTMLSelectElement).value + ".xlsx");
this.spreadsheetObj.open({ file: file as any });
}
request.open("GET", "http://localhost:53142/Files/" + (args.target as HTMLSelectElement).value + ".xlsx");
request.send();
}
|
@ViewChild("default")
public spreadsheetObj: SpreadsheetComponent;
created() {
fetch(
"https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx"
).then(response => {
response.blob().then(fileBlob => {
var file = new File([fileBlob], "Sample.xlsx");
this.spreadsheetObj.open({ file: file }); // To open the excel file
});
});
} |