使用 C# 在 Excel 中更改单元格颜色 [英] Cell color changing in Excel using C#
本文介绍了使用 C# 在 Excel 中更改单元格颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Windows 应用程序将数据表导出到 Excel.它正在工作.现在我想为单元格中的特定文本提供一些颜色.我该怎么做?
I am using a Windows application for exporting a data table to Excel. It's working. Now I want to give some color for particular text in the cell. How shall I do this?
推荐答案
对于文本:
[RangeObject].Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
用于单元格背景
[RangeObject].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
这篇关于使用 C# 在 Excel 中更改单元格颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文