如何使用C#用颜色填充I单元格A1:A5? [英] How can fill I cells A1:A5 with a color using C#?
本文介绍了如何使用C#用颜色填充I单元格A1:A5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码:
Excel.Range chartRange;
chartRange = xlWorkSheet.get_Range("A3", "R3");
我想用一种颜色填充此范围的单元格.我已经尝试过:
I want to fill this range of cells with a color. I have already tried with:
System.Drawing.Color = "yellow"
但是它抛出了一个异常,要求对象引用.
but it is throwing an exception that an object reference is required.
如何修复代码以用颜色填充这些单元格?
How can I fix my code to fill these cells with a color?
推荐答案
尝试一下:
chartRange.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Yellow);
这篇关于如何使用C#用颜色填充I单元格A1:A5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文