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
Thank you for writing.
Both of the requests are not currently supported. I have logged them on our feedback portal, here:
- ADD. RadSpreadsheet - support for Macro-Enabled Workbooks (xlsm)
- FIX. RadSpreadsheet - in-cell drop-down when the cell is validated using multiple values
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
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 ?
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
Hello Hristo,
Thanks for your answer, it works fine.