简体   繁体   English

在Excel中使用C#中的条件格式更改单元格颜色

[英]Cell color change In Excel Using Conditional formatting in C#

I have exported datatable to Excel successfully. 我已将数据表成功导出到Excel。 Now I have to change some cell color using Conditional formatting in Excel sheet using C#. 现在,我必须使用C#在Excel工作表中使用条件格式更改某些单元格颜色。 For example if a cell contains text as "Cat" it should be display in Green color and if a cell contains text as "Dog" it should display in blue Color. 例如,如果一个单元格包含“ Cat”文本,则应以绿色显示,如果一个单元格包含“ Dog”文本,则应以蓝色显示。 Now how can I do this? 现在我该怎么做?

Click the cell and select "Conditional formatting" from the menu. 单击该单元格,然后从菜单中选择“条件格式”。 Then select something like "rules for cells that equals". 然后选择“等于单元格的规则”之类的内容。 Fill in "Cat" as what is should be equal to and choose your formatting. 填写“ Cat”(应等于)并选择格式。

Check this: http://www.contextures.com/xlcondformat03.html 检查此: http : //www.contextures.com/xlcondformat03.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM