Get formula result from RadSpreadsheet

2 posts, 0 answers
  1. David
    David avatar
    3 posts
    Member since:
    Feb 2016

    Posted 21 Nov 2018 Link to this post

    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!

     

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    654 posts

    Posted 17 Dec 2018 Link to this post

    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.

Back to Top