Catch the radSpreadsheet.CommandDescriptors.SaveFile.Command event

2 posts, 0 answers
  1. Patrick
    Patrick avatar
    33 posts
    Member since:
    Aug 2011

    Posted 21 Jul 2016 Link to this post



    I want to be able to receive the file and/or set the file for the radSpreadsheet.CommandDescriptors.SaveFile.Command  command. It appears that no event can be handled before or after the command is executed.



  2. Nikolay Demirev
    Nikolay Demirev avatar
    136 posts

    Posted 25 Jul 2016 Link to this post

    Hi Patrick,

    You could create a custom save command and bind it to the Save button command. This way you won't use the default command descriptor and you will be able to handle the opened file.

    Here is the default command implementation which you could use in your custom command:
    SaveFileDialog saveFileDialog = new SaveFileDialog();
    saveFileDialog.Filter = FileDialogsHelper.GetSaveFileDialogFilter();
    saveFileDialog.FileName = editor.Owner.Workbook.Name;
    if (saveFileDialog.ShowDialog() == true)
        string extension = Path.GetExtension(saveFileDialog.SafeFileName);
        using (Stream output = saveFileDialog.OpenFile())
            WorkbookFormatProvidersManager.Export(editor.Owner.Workbook, extension, output);

    I hope this helps.

    Nikolay Demirev
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top