Other API Samples C# logo

What-If Data Table SpreadsheetGear API Sample

Description

Creates a What-If Data Table to calculate various loan totals based on varying interest rates and terms.

Sample Source Code

// Open workbook with sample data and create some local variables.
SpreadsheetGear.IWorkbook workbook = 
    SpreadsheetGear.Factory.GetWorkbook(@"Files\WhatIfDataTable.xlsx");
SpreadsheetGear.IWorksheet worksheet = workbook.ActiveWorksheet;
SpreadsheetGear.IRange cells = worksheet.Cells;

// Setup a What-If Data Table on the range C7:H12. Note you do need to include the 
// input row (Row 7) and input column (Column C).
cells["C7:H12"].Table(cells["D4"], cells["D3"]);