简体   繁体   English

有没有办法使用 C# 为 Excel 文件的选定单元格着色?

[英]Is there a way to color selected cells of an Excel file using C#?

I am comparing two excel files cell by cell.我正在逐个单元比较两个 excel 文件。 One is source file and another is target file.I want to color those cells which are not matching in the target file.一个是源文件,另一个是目标文件。我想为目标文件中不匹配的单元格着色。 Is there any way to do this without creating any other excel sheet for those cells which are not matching.有没有办法在不为那些不匹配的单元格创建任何其他 excel 表的情况下做到这一点。 I mean to say I want to fill color in those cells which are not matching in target file..我的意思是说我想在目标文件中不匹配的那些单元格中填充颜色..

oResizeRange is a range of cells you selected. oResizeRange 是您选择的单元格范围。 It's of type Office.Interop.Excel.Range它的类型是 Office.Interop.Excel.Range

oResizeRange.Interior.ColorIndex = someindex;

Source资源

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

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