Sample Formula

Use the SetFormula method in the Worksheet class for specifying the formula. Use the SetArrayFormula method for an array formula. Returning the value of the Formula property provides a string containing the written expression of the formula, for example, SUM(A1:B1).

In code the setting of a formula would look something like this in Visual Basic (for illustration purposes only):

   FpSpread1.ActiveSheet.Cells(2, 0).Formula = "SUM(A1:A10)"

or something like this in C#:

   fpSpread1.ActiveSheet.Cells[2, 0].Formula = "SUM(A1:A10)";

and if added in the cell by the end user:

   =SUM(A1:A10)

In this documentation, where examples are shown, the formula appears as:

   SUM(A1:A10)

or

   SUM(3,4,5) gives the result 12

to express that the result of the formula would display the value of 12 in the cell.

Keep these ways of expressing a formula in mind when looking at the examples in this documentation. Refer to the Assembly Reference for more details on the Formula property  and the exact code syntax to use.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.