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
Render Image

Generate an image representation of the results of this sample, which uses the SpreadsheetGear.Drawing.Image class to convert ranges, charts and shapes to images.


Download File

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

Related Samples