Other API Samples

Live SpreadsheetGear API Samples

Range Samples Values and Formulas Create Formula

Create a workbook with cell containing a formula using the =RAND() function.

// Create a new workbook and some local variables.
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();
SpreadsheetGear.IWorksheet worksheet = workbook.ActiveWorksheet;
SpreadsheetGear.IRange cells = worksheet.Cells;

// Set A1 to use the formula =RAND().
cells["A1"].Formula = "=RAND()";
Run This Sample
Download File

Download an Excel Open XML Workbook (*.xlsx) file with the results of this sample.

Related Samples