Please add support for protected worksheets and protected workbooks.
I'm having the same issue that was fixed in the Telerik UI for WinForms RadSpreadsheet. When loading the workbook into a Blazor UI TelerikSpreadsheet control, the validation dropdown shows fine when exported to Excel but the Telerik control doesn't show the dropdown. However, it only allows you to type values in the supplied validation list as expected.
RadSpreadsheet: ListDataValidation not working, dropdown does not appear in control (telerik.com)
ListDataValidationRuleContext context = new(worksheet, ri, ci)
{
InputMessageTitle = "Restricted input",
InputMessageContent = "The input is restricted to the week days.",
ErrorStyle = ErrorStyle.Stop,
ErrorAlertTitle = "Wrong value",
ErrorAlertContent = "The entered value is not valid. Allowed values are the week days!",
InCellDropdown = true,
Argument1 = "Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday"
};
cell.SetDataValidationRule(new ListDataValidationRule(context));
When the Spreadsheet generates the byte array with ExportToExcelAsync(), it doesn't include the information about the active cell and sheet. For example, this restricts the ability to set the number of frozen columns and rows, based on the active cell. One must provide explicit UI for this as a custom tool.
===
TELERIK EDIT: Expanded the request scope to also include the active sheet.
<TelerikSpreadsheet Height="500px" Width="100%">
<SpreadsheetSheets>
<SpreadsheetSheet Name="Sheet1">
<SpreadsheetSheetColumns>
<SpreadsheetSheetColumn Index="0" Width="100px"></SpreadsheetSheetColumn>
<SpreadsheetSheetColumn Index="1" Width="200px"></SpreadsheetSheetColumn>
</SpreadsheetSheetColumns>
<SpreadsheetSheetRows>
<SpreadsheetSheetRow Index="0">
<SpreadsheetSheetCell Value="Item"></SpreadsheetSheetCell>
<SpreadsheetSheetCell Value="Price"></SpreadsheetSheetCell>
</SpreadsheetSheetRow>
<SpreadsheetSheetRow Index="1">
<SpreadsheetSheetCell Value="Apples"></SpreadsheetSheetCell>
<SpreadsheetSheetCell Value="1.50"></SpreadsheetSheetCell>
</SpreadsheetSheetRow>
<SpreadsheetSheetRow Index="2">
<SpreadsheetSheetCell Value="Bananas"></SpreadsheetSheetCell>
<SpreadsheetSheetCell Value="2.00"></SpreadsheetSheetCell>
</SpreadsheetSheetRow>
</SpreadsheetSheetRows>
</SpreadsheetSheet>
</SpreadsheetSheets>
</TelerikSpreadsheet>
On the Spreadsheet control please display a function list when the user types "=" or provide the user with some other reference about the available functions.
I want to change the ColumnsCount property value at runtime, for example, based on the Excel files that the app is loading.
===
TELERIK EDIT:
A possible workaround is to recreate the Spreadsheet component. The downside will be a minor UI flicker. Alternatively, set ColumnsCount to a small value like 1. In this way the component will display only the existing columns in the opened file.
<TelerikNumericTextBox @bind-Value="@SpreadsheetColumnsCount"
Min="0" Max="999"
Width="80px" />
<TelerikButton OnClick="@OnButtonClick">Apply ColumnsCount</TelerikButton>
@if (SpreadsheetVisible)
{
<TelerikSpreadsheet Data="@SpreadsheetData"
ColumnsCount="@SpreadsheetColumnsCount">
</TelerikSpreadsheet>
}
@code {
private byte[]? SpreadsheetData { get; set; }
private int SpreadsheetColumnsCount { get; set; } = 10;
private bool SpreadsheetVisible { get; set; } = true;
private async Task OnButtonClick()
{
SpreadsheetVisible = false;
await Task.Delay(1);
SpreadsheetVisible = true;
}
}
Reproduction: https://blazorrepl.telerik.com/QJEJlAvY33zlToJO18.
To reproduce:
step 1: observe that cells div.k-spreadsheet-fixed-container fills div.k-spreadsheet-view
step 2: Move the splitter handler to left
step 3: Observe that the div.k-spreadsheet-view width is adjusted to the new size of its parent, but div.k-spreadsheet-fixed-container is not.
Expected: Spreadsheet component handles updating the size its parts.
===
ADMIN EDIT
===
A possible workaround for the time being is to simulate the browser resize event - the Spreadsheet is properly resized in this case.
Here is how to achieve that: https://blazorrepl.telerik.com/wzOfQbEW38JtEjFD36.
When copy-pasting a cell from Excel to the Spreadsheet, our component then generates an invalid horizontal alignment value, which does not conform to the document format specification:
<alignment horizontal="start" vertical="bottom" />
The valid values for horizontal do not include start:
<simpleType name="ST_HorizontalAlignment">
<restriction base="xsd:string">
<enumeration value="general"/>
<enumeration value="left"/>
<enumeration value="center"/>
<enumeration value="right"/>
<enumeration value="fill"/>
<enumeration value="justify"/>
<enumeration value="centerContinuous"/>
<enumeration value="distributed"/>
</restriction>
</simpleType>
Here are the steps:
1. Copy some basic content from Excel (two text cells)
2. Paste the content to the Telerik Blazor Spreadsheet component and save the XLSX file
Entering dates in the Blazor spreadsheet act weird if you enter a 2 digit year. It seems to subtract a day when you remove focus from the cell.
Start by entering a date like 2/2/25:
Then hit enter or otherwise remove focus from the cell and this is what it changes it to. Notice it subtracts a day:
Then put focus back on the cell:
Now look at the editor at the top:
I note that when you enter a two digit year in Excel it defaults the century to 20 when you enter a year less than 30. It defaults a century of 19 when you enter a year >= 30. It appears that with the Telerik Blazor spreadsheet it always defaults the century to 19. You can make arguments on either side of that but the real issue here is that it subtracts a day when you enter a two digit year. It doesn't do that when you enter a 4 digit year.
The related thing that becomes an issue is when you export the spreadsheet to a byte array and evaluate the cell RawValue. When you enter a 4 digit year, you get a raw value that is a positive number and you can use FormatHelper.ConvertDoubleToDateTime to get the date value. When you enter a 2 digit year and get the raw value, it is a negative number, and when you call FormatHelper.ConvertDoubleToDateTime it returns null.
Can you please comment on the rhyme or reason the spreadsheet behaves this way? Or is this a bug(s)?
Thanks.