Monday, December 8, 2008

Programmatically set border width of Excel cell

This MSDN article briefly explains how to do this: http://msdn.microsoft.com/en-us/library/bb209714.aspx

and here is an example that I am using in my code. It just sets the left border weight to thick for the cell located at 1,2. 

range = (Microsoft.Office.Interop.Excel.Range)wsheet.Cells[1, 2];
                                range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeLeft].Weight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThick;

0 comments: