Spread Windows Forms 17
Spread Windows Forms 17.0 Product Documentation / Developer's Guide / Formulas in Cells / Allowing the User to Enter Formulas
In This Topic
    Allowing the User to Enter Formulas
    In This Topic

    Spread for WinForms supports the ability to type in a formula by simply starting with an equal’s sign (=). This is the default behavior in the worksheet where the displayed result depends on the cell type.

    For example, an integer cell type displays the result as an integer, even if the result of the formula is not an integer. In this case, a number may appear rounded.

    You can control whether to allow the users to enter formulas in a worksheet by setting the boolean value in FpSpread.AllowUserFormulas property.

    C#
    Copy Code
    fpSpread1.AllowUserFormulas = true;
    
    VB
    Copy Code
    fpSpread1.AllowUserFormulas = True
    

    To define specific formatting for currency and date cells or setting various cell types, refer to Working with Editable Cell Types.

    For information on the floating formula bar, where users can type in formulas and select cells dynamically, refer to Working with the Formula Text Box.

    Using Plus or Minus Sign

    You can also input a formula in a worksheet by starting with a plus sign (+) or a minus sign (-). These signs function the same as the equal sign (=) and Excel users who are accustomed to using the plus or minus sign don't have to change their behavior when using Spread.

    The equal sign is still automatically added before, so that formulas are converted to work as expected. For example, if you enter "+SUM(1,2)" when editing, it will be "=+SUM(1,2)" when displayed again.

    When using the plus or minus sign to enter a formula, the users should be aware of the following behavior:

    Note: This behavior only works with default cell type in flat style mode.

    Using the Properties Window

    1. At design time, in the Properties window (in the Behavior category), select the AllowUserFormulas property.
    2. Select True from the drop-down list to allow users to enter formulas or select False to prohibit them.

    Using the Spread Designer

    1. Select the Spread component (or select Spread from the pull-down menu).
    2. In the property list for the component (in the Behavior category), select the AllowUserFormulas property and select the value True.

    From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.

    See Also