Get Started
Usage API

GetFormula

GetFormula() → { string }

Gets the formula of the first cell in range.

Parameters:

This method doesn't have any parameters.

Returns:

Type
string

Example

Copy code
builder.CreateFile("xlsx");
oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("B1").SetValue(1);
oWorksheet.GetRange("C1").SetValue(2);
oRange = oWorksheet.GetRange("A1");
oRange.SetValue("=SUM(B1:C1)");
oFormula = oRange.GetFormula();
oWorksheet.GetRange("A3").SetValue("Formula of cell A1: " + oFormula);
builder.SaveFile("xlsx", "GetFormula.xlsx");
builder.CloseFile();

Resulting document