设置样式到第一列excel

我们怎样才能在excel的第一列中设置所有单元格的样式? 例如:

Excel.Range rangeRows; rangeRows = xlWorkSheet.get_Range("a1","a174"); rangeRows.Font.Bold = true; 

将整个样式设置为整列会更好吗?

提前致谢

我会认真考虑看EPPlus,如果你必须用Excel编程方式做任何事情。

它支持多种不同的方法来创build范围(通过字母数字ID或索引等)

例如

 var newFile = new FileInfo(outputDir.FullName + @"\sample6.xlsx"); var pck = new ExcelPackage(newFile); var ws = pck.Workbook.Worksheets.Add("Content"); ws.Cells["A:B"].Style.Font.Bold = true; //Sets font-bold to true for column A & B