Microsoft Office Tutorials and References
In Depth Information
Excel formulae
private void Sheet2_Startup(object sender, System.EventArgs e)
{
// Range of cell for calculation
Microsoft.Office.Tools.Excel.NamedRange AuthorCellRange1 =
this.Controls.AddNamedRange(this.Range["B1", "B2"],
"AuthorNamedRange1");
// Cell range to display the calculated result
Microsoft.Office.Tools.Excel.NamedRange AuthorCellRange2 =
this.Controls.AddNamedRange(this.Range["B3", missing],
"AuthorNamedRange2");
// Default value for the cells
AuthorCellRange1.Value2 = 10;
// Formula to multiply the cell values
AuthorCellRange2.Formula = "=B1*B2";
// Formula hiding property for protected sheets
AuthorCellRange2.FormulaHidden = true;
// Calculate the cell values
AuthorCellRange2.Calculate();
}
The following screenshot shows the results of adding and executing the
preceding code:
 
Search JabSto ::




Custom Search