Cell color change In Excel Using Conditional formatting in C#

淺唱寂寞╮ 提交于 2019-12-11 05:37:11

问题


I have exported datatable to Excel successfully. Now I have to change some cell color using Conditional formatting in Excel sheet using C#. 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. Now how can I do this?


回答1:


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.

Check this: http://www.contextures.com/xlcondformat03.html




回答2:


Refer to MSDN: http://msdn.microsoft.com/en-us/library/bb404903.aspx



来源:https://stackoverflow.com/questions/2453152/cell-color-change-in-excel-using-conditional-formatting-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!