Disable Text Input on FormulaEditor

Posted by: nkhoury on 21 March 2025, 6:59 pm EST

  • Posted 21 March 2025, 6:59 pm EST

    Is there a way to disable the GC.Spread.Sheets.FormulaPanel.FormulaEditor similar to how a text input would be disabled or set as readonly? I would like to do this independently of the sheet protection, meaning the user could still edit the spreadsheet, bot not the formula editor.

  • Posted 24 March 2025, 4:07 am EST

    You can use the enableFormulaTextbox method to hide the Block Blast formula text box entirely, but this might not meet your requirement if you want it visible but read-only.

  • Posted 24 March 2025, 8:05 am EST - Updated 24 March 2025, 8:10 am EST

    Hi,

    Apologies for the delay caused over the weekend.

    There is no direct way to disable the GC.Spread.Sheets.FormulaPanel.FormulaEditor using the SpreadJS API. However, CSS can be utilized to disable the pointer events on the Formula Editor Panel. Please refer to the code snippet below which illustrates the same:

    CSS
    .gc-formula-editor-content-container
      .gc-formula-editor-container
      .cm-editor
      .cm-scroller
      .cm-content {
        pointer-events: none;
    }

    You can further refer to the below attachment which uses the above code snippet and disables the formula editor panel irrespective of the sheet protection.

    Refer to the attached GIF and sample.

    Gif:

    Sample: FormulaEditorPanel.zip

    Regard,

  • Posted 25 March 2025, 3:55 pm EST

    thanks, I had to set “-webkit-user-modify: read-only” in addition to your css.

  • Posted 26 March 2025, 5:02 am EST

    Hi,

    If it is only required to disable the user modification, in that case, you can use the -webkit-user-modify: read-only property instead of pointer-events: none, which disables all the pointer events. The modified code will look as follows:

    .gc-formula-editor-content-container
      .gc-formula-editor-container
      .cm-editor
      .cm-scroller
      .cm-content {
        -webkit-user-modify: read-only;
    }

    Please feel free to reach out if you require any further guidance.

    Kind Regards,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels