Edit

Share via


Word.SelectionInsertFormulaOptions interface

Represents the options for the Selection.insertFormula method.

Remarks

[ API set: WordApiDesktop 1.4 ]

Properties

formula

If provided, specifies the mathematical formula you want the = (Formula) field to evaluate. The formula property is optional only if the selection is in a cell and there is at least one cell that contains a value above or to the left of the cell that contains the insertion point. If the cells above the insertion point contain values, the inserted field is {=SUM(ABOVE)}; if the cells to the left of the insertion point contain values, the inserted field is {=SUM(LEFT)}. If both the cells above the insertion point and the cells to the left of it contain values, Microsoft Word uses the following rules to determine which SUM function to insert.

  • If the cell immediately above the insertion point contains a value, Word inserts {=SUM(ABOVE)}.

  • If the cell immediately above the insertion point doesn't contain a value but the cell immediately to the left of the insertion point does, Word inserts {=SUM(LEFT)}.

  • If neither cell immediately above the insertion point nor the cell immediately below it contains a value, Word inserts {=SUM(ABOVE)}.

  • If you don't specify the formula property and all the cells above and to the left of the insertion point are empty, using the = (Formula) field causes an error.

numberFormat

If provided, specifies the format for the result of the = (Formula) field.

Property Details

formula

If provided, specifies the mathematical formula you want the = (Formula) field to evaluate. The formula property is optional only if the selection is in a cell and there is at least one cell that contains a value above or to the left of the cell that contains the insertion point. If the cells above the insertion point contain values, the inserted field is {=SUM(ABOVE)}; if the cells to the left of the insertion point contain values, the inserted field is {=SUM(LEFT)}. If both the cells above the insertion point and the cells to the left of it contain values, Microsoft Word uses the following rules to determine which SUM function to insert.

  • If the cell immediately above the insertion point contains a value, Word inserts {=SUM(ABOVE)}.

  • If the cell immediately above the insertion point doesn't contain a value but the cell immediately to the left of the insertion point does, Word inserts {=SUM(LEFT)}.

  • If neither cell immediately above the insertion point nor the cell immediately below it contains a value, Word inserts {=SUM(ABOVE)}.

  • If you don't specify the formula property and all the cells above and to the left of the insertion point are empty, using the = (Formula) field causes an error.

formula?: string;

Property Value

string

Remarks

[ API set: WordApiDesktop 1.4 ]

numberFormat

If provided, specifies the format for the result of the = (Formula) field.

numberFormat?: string;

Property Value

string

Remarks

[ API set: WordApiDesktop 1.4 ]