Export to Excel: The Save File Dialogue Title on Windows

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.

20220206193626.png


4 Replies

SK Sujith Kumar Rajkumar Syncfusion Team February 7, 2022 10:33 AM UTC

Hi Arvin, 
 
Greetings from Syncfusion support. 
 
We are not clear on your exact requirement from the provided information. Do you wish to modify the file name of the exported excel file? If so you can achieve it by using the fileName property of the excelExportproperties. More details on this can be checked in the below documentation link, 
 
 
If we misunderstood your query or if you require any further assistance, then please get back to us. 
 
Regards, 
Sujith R 



AS Arvin Staff replied to Sujith Kumar Rajkumar February 7, 2022 11:00 AM UTC

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



SK Sujith Kumar Rajkumar Syncfusion Team February 9, 2022 03:43 AM UTC

Hi Arvin, 
 
We are currently validating your query from our end and we will share you the further details on or before 10th February 2022. 
 
Until then your patience is appreciated. 
 
Regards, 
Sujith R 



SK Sujith Kumar Rajkumar Syncfusion Team February 10, 2022 06:08 AM UTC

Hi Arvin, 
 
Thanks for your patience. 
 
Your requirement can be achieved by dynamically saving the exported excel workbook as a blob as demonstrated in the below code snippet, 
 
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(); 
        } 
    } 
} 
 
We have prepared a sample based on this for your reference. You can find it below, 
 
 
Let us know if you have any concerns. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon