Disabling the formula functionalities

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    2 posts
    Member since:
    Mar 2013

    Posted 22 Apr 2013 Link to this post


    I was looking for a way to disable the formula capabilities of the control is this possible?(e.g =SUM(A+B)).
    This without the need to disable the cells.

    Kind regards,

  2. Boryana
    Boryana avatar
    330 posts

    Posted 23 Apr 2013 Link to this post

    Hello Thomas,

    Thank you for contacting us.

    A cell will display its literal content if its format is set to Text. The following snippet assigns the cell A1 in the active worksheet a formula value and sets its format to Text. As a result,  A1 will display =SUM(1, 2, 3) instead of 6

    CellSelection cellA1 = this.radSpreadsheet.ActiveWorksheet.Cells[0, 0];
    cellA1.SetValue("=SUM(1, 2, 3)");
    cellA1.SetFormat(new CellValueFormat("@"));

    If you would like to apply the Text format to all entered values in a worksheet, feel free to use the following sample code:
    Worksheet activeWorksheet = this.radSpreadsheet.ActiveWorksheet;
    activeWorksheet.Cells[activeWorksheet.UsedCellRange].SetFormat(new CellValueFormat("@"));

    I hope you will find my answer helpful. Let me know if you have further questions.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top