Hi,
I was wondering if I could change the save file dialogue title on Windows in the following screenshot when exporting to Excel.
Regards,
Arvin
P.S. This save file dialogue appears because the demo is Electron + Vue.js 3.
Hi Sujith,
This scenario uses Electron to build a desktop demo. Let me explain it in detail. Typically, when the components library is used to build a website, exporting to Excel can cause downloading to happen immediately in the browser. But when it comes to the desktop app built with Electron and the components library, exporting to Excel will first pop up a dialogue on Windows asking for the place to save the exported Excel file, as shown in the screenshot in the previous post. It is not about how to modify the file name. The problem is all about the dialogue title. It seems the title shown is the link (blob:http://...) for "downloading" the Excel file to the target place.
Hence, my question is that is it possible to change the dialogue title?
Regards,
Arvin
|
methods: {
toolbarClick(args) {
if (args.item.id === 'Grid_excelexport') {
this.$refs.gridObj.excelExport(null, false, null, true).then((workbook) => {
var book = new Workbook(workbook, 'xlsx');
book.saveAsBlob('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet').then((blobData) => {
this.downloadExcel(blobData.blobData);
});
});
}
},
downloadExcel(resData) {
var ieEDGE = navigator.userAgent.match(/Edge/g);
var ie = navigator.userAgent.match(/.NET/g); // IE 11+
var oldIE = navigator.userAgent.match(/MSIE/g);
var blob = new window.Blob([resData], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
});
if (ie || oldIE || ieEDGE) {
window.navigator.msSaveBlob(blob, 'Output.xlsx');
} else {
var fileURL = URL.createObjectURL(blob);
var anchor = document.createElement('a');
anchor.download = 'output.xlsx';
anchor.rel='nofollow' href = fileURL;
anchor.click();
}
}
} |