Microsoft.Office.Interop.Excel.Range titleRange = worksheet.get_Range(worksheet.Cells[1, 1], worksheet.Cells[2, 2]);
titleRange.Interior.Color = Color.FromArgb(220, 20, 60);//设置颜色
抛异常
System . Color参数或返回值的型在内的方法叫出IDispatch中不能
把你的颜色用System.Drawing.ColorTranslator.ToOle封一下
例如:titleRange.Interior.Color = System.Drawing.ColorTranslator.ToOle(Color.FromArgb(220, 20, 60));
我用了另外一种编辑颜色的方法,不过还是谢谢你
谢谢大佬,你的代码我直接拿来就成功了。。。。VS2015+office2010...
可以试一下这个https://www.e-iceblue.cn/cells/c-set-background-color-and-pattern-for-excel-cells.html