How to hide save-as dialog during save operation

Dear,

In 'beforeSave' I set args.needBlobData = true and args.isFullPost = false to get the blob data in 'saveComplete' to process blob in server side code.


When I run my code and when I choose 'File > save as > Microsoft Excel' in the Spreadsheet menu I get below 'save-as' dialog / prompt to enter a filename.


How can I hide this prompt? (as I don't want to enter filename)

Thx

Frederik



5 Replies

VR Vasanth Ravi Syncfusion Team May 23, 2023 11:53 AM UTC

Hi Frederik,


Your requirement can be achieved using dialogBeforeOpen event. We have prepared a sample that meets out your requirement and attached below for reference.


CODE BLOCK:


dialogBeforeOpen(args) {

      if(args.dialogName === "Save As"){

      args.cancel = true;

   }

}


Stackblitz Sample: https://stackblitz.com/edit/eb2gl9?file=index.ts


Get back to us if you need any other further assistance regarding.



FG Frederik Gysel May 25, 2023 06:32 PM UTC

Thx for he reply.

args.cancel = true; stops the save operation which is not what I wanted to happen.

I could achieve what I want by creating a new button in the ribbon.
Another question related to customizing the ribbon:

when I create a new ribbon before 'Home'



and run the code, the selected ribbon is 'new tab' but the content of the new tab is the content of the Home tab.



When i click Home tab:

When i click 'new tab'


How can I resolve this and immediatly see the contents of the last screenshot when I run the Spreadsheet contro?


Thx

Frederik



SP Sangeetha Priya Murugan Syncfusion Team May 29, 2023 12:08 PM UTC

Hi Frederik,


Your requirement can be achievable by setting the selectedItem property as shown below for spreadsheet ribbon tab.


 

 created: (): void => {

    //Applies cell and number formatting to specified range of the active sheet

    spreadsheet.cellFormat(

      { fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' },

      'A1:F1'

    );

    spreadsheet.numberFormat('$#,##0.00', 'F2:F31');

    spreadsheet.addRibbonTabs(

      [

        {

          header: { text: 'New Tab' },

          content: [{ text: 'opslaan2', tooltipText: 'Excel opslaan2' }],

        },

      ],

      'Home'

    );

    document.getElementsByClassName(

      'e-tab'

    )[0].ej2_instances[0].selectedItem = 3;

    setTimeout(() => {

      document.getElementsByClassName(

        'e-tab'

      )[0].ej2_instances[0].selectedItem = 1;

  }, 10);

 

   

  },


For your convenience, we have prepared the sample based on our suggestion. Please find the link below.


Sample Link : https://stackblitz.com/edit/eb2gl9-te6qtn?file=index.ts



FG Frederik Gysel June 5, 2023 09:35 AM UTC

It works, thanks a lot!

Rgds

Frederik



SP Sangeetha Priya Murugan Syncfusion Team June 6, 2023 04:18 AM UTC

Hi Frederik,



We are happy to hear that your issue has been resolved, please get back to us if you need any further assistance on this.


Loader.
Up arrow icon