Macros and Dropdown

5 posts, 0 answers
  1. Frédéric
    Frédéric avatar
    8 posts
    Member since:
    Oct 2017

    Posted 10 Nov Link to this post

    Hi,

    I use a spreadsheet to display a xlsm file which contains buttons and data validation from a list.

    The attached file "Excel" shows how this file looks in Excel.

    The attached file "SpreadSheet" shows how this file looks in the spreadsheet :

    - buttons are not displayed

    - the data validation in the cell works correctly according to the list but drop down arrow is not shown in the cell even if the options "In-cell dropdown" is checked

    Thanks for your help

    Regards

     

     

  2. Hristo
    Admin
    Hristo avatar
    1088 posts

    Posted 13 Nov Link to this post

    Hello Frédéric,

    Thank you for writing.

    Both of the requests are not currently supported. I have logged them on our feedback portal, here: 
    I have updated your Telerik points for bringing this to our attention. Additionally, you can subscribe to the items and be updated with all of their status changes.

    I hope this information is useful. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Frédéric
    Frédéric avatar
    8 posts
    Member since:
    Oct 2017

    Posted 14 Nov in reply to Hristo Link to this post

    Hello Hristo,

    Thanks for your answer.

    You answered to me how to set initial directory when saving a pdf (https://www.telerik.com/forums/initial-directory).

    I'd like to do the same by saving the spreadsheet.

    The problem is that I don't find any save function in Spreadsheet or in workbook.

    So, how can I save document by code ?

     

  4. Hristo
    Admin
    Hristo avatar
    1088 posts

    Posted 14 Nov Link to this post

    Hello Frédéric,

    Thank you for writing.

    You can handle the UICommandExecuting event and cancel it preventing the default implementation to execute. Then you can perform the custom save operation: 
    public partial class SpreadsheetForm : Telerik.WinControls.UI.RadForm
    {
        public SpreadsheetForm()
        {
            InitializeComponent();
     
            this.radSpreadsheet1.SpreadsheetElement.ActiveSheetEditor.UICommandExecuting += ActiveSheetEditor_UICommandExecuting;
        }
     
        private void ActiveSheetEditor_UICommandExecuting(object sender, UICommandExecutingEventArgs e)
        {
            if (e.Command == this.radSpreadsheet1.SpreadsheetElement.ActiveSheetEditor.CommandDescriptors.SaveFile.Command)
            {
                e.Cancel();
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.InitialDirectory = "C:\\Users\\Administrator\\Desktop";
                saveFileDialog.Filter = FileDialogsHelper.GetSaveFileDialogFilter();
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        string extension = Path.GetExtension(saveFileDialog.FileName);
                        using (Stream output = saveFileDialog.OpenFile())
                        {
                            WorkbookFormatProvidersManager.Export(this.radSpreadsheet1.Workbook, extension, output);
                        }
                    }
                    catch (IOException ex)
                    {
                        LocalizableException exception = new LocalizableException(string.Empty, "Spreadsheet_ErrorExpressions_FileAccessError");
                        UICommandErrorEventArgs args = new UICommandErrorEventArgs(exception);
                        this.ShowException(this.radSpreadsheet1.SpreadsheetElement.ActiveSheetEditor, args);
     
                    }
                    catch (Exception ex)
                    {
                        LocalizableException exception = new LocalizableException(string.Empty, "Spreadsheet_ErrorExpressions_UnableToSaveFile");
                        UICommandErrorEventArgs args = new UICommandErrorEventArgs(exception);
                        this.ShowException(this.radSpreadsheet1.SpreadsheetElement.ActiveSheetEditor, args);
                    }
                }
            }
        }
     
        private void ShowException(object owner, UICommandErrorEventArgs args, EventHandler<WindowClosedEventArgs> closedEventHandler = null)
        {
            string header = Telerik.WinForms.Spreadsheet.LocalizationManager.GetString("Error");
            string content = Telerik.WinForms.Spreadsheet.LocalizationManager.GetMessageString(args.Exception);
            MessageBoxHelper.Alert(this.radSpreadsheet1.SpreadsheetElement, owner, header, content, closedEventHandler);
        }
    }

    If you want to save the document programmatically you can directly access it through the RadSpreadsheet.Workbook property and then use the SpreadProcessing libraries.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Frédéric
    Frédéric avatar
    8 posts
    Member since:
    Oct 2017

    Posted 14 Nov in reply to Hristo Link to this post

    Hello Hristo,

    Thanks for your answer, it works fine.

Back to Top