Handle the case where the formula starts with "=+". Detailed information: https://professor-excel.com/equal-plus-excel-formulas/
Workaround: replace the "=+" with "="
CellRange usedCellRange = workbook.Worksheets[0].UsedCellRange;
for (int rowIndex = usedCellRange.FromIndex.RowIndex; rowIndex <= usedCellRange.ToIndex.RowIndex; rowIndex++)
{
for (int columnIndex = usedCellRange.FromIndex.ColumnIndex; columnIndex <= usedCellRange.ToIndex.ColumnIndex; columnIndex++)
{
CellSelection cell = workbook.Worksheets[0].Cells[rowIndex, columnIndex];
FormulaCellValue formulaCellValue =cell.GetValue().Value as FormulaCellValue;
if (formulaCellValue == null)
{
continue;
}
CellValueFormat format = cell.GetFormat().Value;
string resultValueAsString = formulaCellValue.GetValueAsString(format);
Console.WriteLine(resultValueAsString);
if (resultValueAsString.StartsWith("=+"))
{
resultValueAsString = resultValueAsString.Remove(1, 1);
cell.SetValue(resultValueAsString);
}
}
}
radSpreadsheet.Workbook = workbook;
I open an xlsx file thant i create with Excel and edit it with RadSpreadProcessing.
But then I can't display it in a RadSpreadsheet control. An error is displayed during execution on localhost.
Here is the error message:
Exception non gérée à la ligne 48298, colonne 17 dans http://localhost:53844/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:fr-CA:bc17b1ef-7a1b-49cb-a795-5f1c64597a53:ea597d4b:b25378d2;Telerik.Web.UI:fr-CA:b87b3d5b-f055-4852-bdaf-fef1991116e3:16e4e7cd:f7645509:22a6274a:33715776:8674cba1:7c926187:88144a7a:b7778d6c:c08e9f8a:59462f1:a51ee93e:24ee1bba:6d43f6d9:e330518b:1e771326:8e6f0d33:864068a5:6a6d718d:58366029:874f8ea2:4cd1fec6:71188da4:487c8be1:670fdf23:d944e0f6:c442ac3f:ec7335e:2e4adfe5:b4bec146:77613e24:69667591:a4c22f0d:e0037459:2f872eeb:75e7b247:b9057478:e8e3832e:728f182a:c4143936:5f88c545:6ed7f76e:32b48b51:935ec1c6:f0c58c30:16dc2978:1611ddf4:1bfaef2a:26e91122:c128760b:a7e79140:185812c5:f46195d3:6b3f73b3:2003d0b8:aa288e2d:b092aa46:a44b89c4:c8618e41:e4f8f289:1a73651d:16d8629e:2bef5fcc:a9b7ace7:e085fe68:52af31a4:5fa37e7e
0x800a139e - Erreur d’exécution JavaScript: Expected op «,» but found punc «;» (input: IF(D8<>0;E8/D8;0))
If a workbook was created with Excel, an error prevents it from being opened programmatically in a RadSpreadsheet control. Although it can be displayed there using the open button of the RadSpreadsheet. This error does not occur if you copy the contents of this workbook into the RadSpreadsheet and then save it with the save button on the RadSpreadsheet.
Thank you
Add support for the EDATE function.
Use the attached custom function as a workaround.