This is a migrated thread and some comments may be shown as answers.

Macros and Dropdown

4 Answers 139 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Frédéric
Top achievements
Rank 1
Frédéric asked on 10 Nov 2017, 09:28 AM

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

 

 

4 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 13 Nov 2017, 02:53 PM
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.
0
Frédéric
Top achievements
Rank 1
answered on 14 Nov 2017, 10:38 AM

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 ?

 

0
Hristo
Telerik team
answered on 14 Nov 2017, 01:24 PM
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.
0
Frédéric
Top achievements
Rank 1
answered on 14 Nov 2017, 02:24 PM

Hello Hristo,

Thanks for your answer, it works fine.

Tags
Spreadsheet
Asked by
Frédéric
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Frédéric
Top achievements
Rank 1
Share this question
or