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

Get formula result from RadSpreadsheet

1 Answer 102 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 21 Nov 2018, 06:43 PM

Hi, there!

I'm trying to get a calculated cell value from a RadSpreadsheet. The documentation says I can use the class FormulaCellValue, but it only works for Worksheets from the Telerik.Windows.Documents.Spreadsheet.Model package, or so it seems, because I use the following code:

Worksheet sheet = RadSpreadsheet1.Sheets[0];
foreach(Row row in sheet.Rows)
{
    ...
    string formula = row.Cells[3].Formula;
    Model.FormulaCellValue val = row.Cells[3].Value as Model.FormulaCellValue;
    ...
}

Here, Worksheet is from the Telerik.Web.Spreadsheet package. The variable formula gets the text of the formula right, but val is null. The cell is showing the result correctly on the spreadsheet. What is wrong here?

Thank you!

 

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 17 Dec 2018, 10:15 AM
Hello David,

The Telerik UI for ASP.NET AJAX and the Document Processing Library both have sheets and workbook classes which are not interchangeable. More information you can find here: Understanding Telerik AJAX and Document Processing Library Spreadsheet Workbook and Worksheets.

With that said, if you really need the evaluated formula, you can add the AJAX sheets to a workbook, convert it to a DPL workbook and access the cell value using the API of the DPL instances as described in the KB article.

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

Tags
Spreadsheet
Asked by
David
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or