SpreadsheetRibbon Close Menu Item

Is it possible to remove or inhibit the File -> Close menu item?

I am trying to use the ribbon with a spreadsheet on a form in an MDI application. Currently if I click the Close menu entry it closes my entire application, I was expecting it to close the current spreadsheet and open a blank one, or at most close my form.

I am currently using version 15.3 0.26 so will update to the latest version but I have searched the documentation, knowledge base and forum and could not find an answer.

Thanks in advance

Dave Moor


1 Reply

BR Backia Raj Kanagaraj Syncfusion Team April 17, 2018 08:23 AM UTC

Hi David, 
 
We have checked your reporting issue and achieved your requirement(i.e. if we close current spreadsheet and open a blank one). 
 
You can override close button action in ribbon backstage setting Spreadsheet.Commands.FileClose by writing customer command overriding from existing FileCloseCommand command. Please see below code snippet.  
 
Code: 
 
spreadsheet.Commands.FileClose = new FileCloseCommandExt(spreadsheet, "FileClose"); 
 
public class FileCloseCommandExt : FileCloseCommand 
    { 
        public FileCloseCommandExt(Spreadsheet spreadsheet, string commandName) : base(spreadsheet, commandName) 
        { 
 
        } 
        
        public override void Execute(object parameter) 
        { 
            this.SfSpreadsheet.Commands.FileNew.Execute(true); 
        } 
    } 
 
We have prepared the sample. Please find below sample link for your reference, 
 
 
Regards, 
Backia Raj Kanagaraj 
 


Loader.
Up arrow icon