Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
in excel how to set empty cell to be pointed out in Back ground color
 
xlRow = xlRow + 1;
                    xlWorkSheet.Cells[xlRow, 1] = "Date";
                    xlWorkSheet.Cells[xlRow, 2] = "Session 1";
                    xlWorkSheet.Cells[xlRow, 3] = "Session 2";
                    xlWorkSheet.Cells[xlRow, 4] = "Session 3";
                    xlWorkSheet.Cells[xlRow, 5] = "Session 4";
                    chartRange = xlWorkSheet.get_Range("A" + xlRow, "E" + xlRow);
                    chartRange.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    chartRange.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
                    chartRange.Font.Bold = true;
                    chartRange = xlWorkSheet.get_Range("A" + xlRow, "A" + xlRow);
                    chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                    chartRange = xlWorkSheet.get_Range("B" + xlRow, "B" + xlRow);
                    chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                    chartRange = xlWorkSheet.get_Range("C" + xlRow, "C" + xlRow);
                    chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                    chartRange = xlWorkSheet.get_Range("D" + xlRow, "D" + xlRow);
                    chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                    chartRange = xlWorkSheet.get_Range("E" + xlRow, "E" + xlRow);
                    chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                    xlRow = xlRow + 1;
from my below code output as follows;
 

AFF
Date Session1 Session2 Session3 Session4
 
15/1/2013 Rk Vk
16/1/2013 MK CK
17/1/2013 Sj GS.
 
from the above output i want to set empty cell to be filled with Any Background color,
 
how can i do.empty cell to be set in a back ground color.
 
from my code how to set any back ground color for empty cell in excel.
 

help me.
 
from my code use it.
Posted 21-Jan-13 23:29pm
Edited 21-Jan-13 23:54pm
60.7K
v3

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

  Print Answers RSS
0 OriginalGriff 478
1 Sergey Alexandrovich Kryukov 305
2 PhilLenoir 115
3 RajeeshMenoth 110
4 Uma Shankar Patel 80
0 Sergey Alexandrovich Kryukov 6,557
1 OriginalGriff 5,966
2 CPallini 2,473
3 Richard MacCutchan 1,687
4 Abhinav S 1,540


Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100