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.
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.
From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.