Hi Seshadri,
May the following sample code help you for your need, kindly consult it:
private void Page_Load(object sender, System.EventArgs e)
{
// Creates a sheets object.
WebWorksheets sheets = GridWeb1.WebWorksheets;
// Creates a cells object with reference to first sheet 's cells.
WebCells cells = sheets[0].Cells;
WebCell cell = cells["A1"];
// Implements a formula on it.
cell.Formula = "=B1+C1";
cell = cells["A2"];
//Implements a formula on it.
cell.Formula = "=A1+C2";
GridWeb1.WebWorksheets[0].Cells["B1"].PutValue(1);
GridWeb1.WebWorksheets[0].Cells["C1"].PutValue(3);
GridWeb1.WebWorksheets[0].Cells["C2"].PutValue(2);
foreach (WebCell cell1 in sheets[0].Cells)
{
if(cell1.Formula != null)
{
cell1.Style.BackColor = Color.Red;
}
}
// Put user code to initialize the page here
}
Thank you.
Amjad Sahi
Support Developer,
Aspose Nanjing Team
Contact Us