Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Code as follows;

C#
sql ="select * FROM Tb_SCh_TIme_Table P PIVOT ";
                  sql = sql + "(MAX(Faculty_Code) FOR Session IN ([1],[2],[3] ,[4])) AS PVT ";
                  sql = sql + " where course = '" + dr[0].ToString().Trim() + "' order by date";
                  Xldr = GFun.ReadSql(sql);
                  while (Xldr.Read())
                  {
                      xlWorkSheet.Cells[xlRow, 1] = Xldr[1].ToString();
                      xlWorkSheet.Cells[xlRow, 2] = Xldr[3].ToString();
                      xlWorkSheet.Cells[xlRow, 3] = Xldr[4].ToString();
                      xlWorkSheet.Cells[xlRow, 4] = Xldr[5].ToString();
                      xlWorkSheet.Cells[xlRow, 5] = Xldr[6].ToString();
                      if (Xldr[3].ToString().Trim() == "")
                      {
                          //xlWorkSheet.Cells.Interior.ColorIndex = Color.Red;
                          xlWorkSheet.Cells.Interior.Color = Color.Red;
                      }
                  }


i tried the above code. in excel if its empty cell that cell to be filled with some back ground color i tried. but it is not working.

Below code is correct ;

C#
if (Xldr[3].ToString().Trim() == " ")
 {
xlWorkSheet.Cells.Interior.Color = Color.Red;
 }


i tried but is not working .how can i do. from my above code.help me.
Posted
Updated 22-Jan-13 1:05am
v2
Comments
Ruchin Munjal 22-Jan-13 16:44pm    
what is xlWorkSheet? a little background on your components may get you an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900