1 Microsoft.Office.Interop.Excel.Range range;
1 for (int i = 0; i < dt.Columns.Count; i++) 2 { 3 worksheet.Cells[1, i + 1] = dt.Columns[i].ColumnName; 4 range = (Microsoft.Office.Interop.Excel.Range)worksheet.Cells[1, i + 1]; 5 //设置区域背景色 6 range.Interior.ColorIndex = 15; 7 }
原文:http://www.cnblogs.com/zhaomengmeng/p/4995538.html