Sign In  Sign Up Live-Chat

Colour for particular cell

Last post 07-24-2008, 8:32 AM by Amjad Sahi. 1 replies.
Sort Posts: Previous Next
  •  07-24-2008, 8:11 AM 136761

    Colour for particular cell

    Hi,

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

    can you please tell me the solution.

    thanks and regards,

    seshadri.

     
  •  07-24-2008, 8:32 AM 136767 in reply to 136761

    Re: Colour for particular cell

    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
     
View as RSS news feed in XML