Free Support Forum -

Colour for particular cell


This is seshadri.I want to put different colour for cell which contain formulae.

can you please tell me the solution.

thanks and regards,


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";

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.