有没有办法使用C#为Excel文件的选定单元格进行颜色打印? [英] Is there a way to color selected cells of an Excel file using C#?

查看:160
本文介绍了有没有办法使用C#为Excel文件的选定单元格进行颜色打印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在逐个细胞地比较两个excel文件。
一个是源文件,另一个是目标文件。我想对目标文件中不匹配的单元格进行着色。
有没有什么办法可以做到这一点,而不是为那些不匹配的单元格创建任何其他excel表。
我的意思是说我想在目标文件中不匹配的单元格中填充颜色。

解决方案

oResizeRange是您选择的一系列单元格。它的类型是Office.Interop.Excel.Range

  oResizeRange.Interior.ColorIndex = someindex; 

来源


I am comparing two excel files cell by cell. 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. 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. It's of type Office.Interop.Excel.Range

oResizeRange.Interior.ColorIndex = someindex;

Source

这篇关于有没有办法使用C#为Excel文件的选定单元格进行颜色打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆