简体   繁体   English

有没有办法使用C#更改Excel单元格的颜色?

[英]Is there Any way to change the colour of an Excel Cell using C#?

I am working on an ASP project where I need to Change the color of the cells based on some validation Checks and return it to user. 我正在开发一个ASP项目,我需要根据一些验证检查更改单元格的颜色并将其返回给用户。

Currently I have successfully Implemented this functionality using Excel 12.0 Object Library. 目前,我已使用Excel 12.0对象库成功实现了此功能。 But the problem is that I need to improve performance. 但问题是我需要提高性能。 InterOp library is very slower than what I expected. InterOp库比我预期的要慢。

Is there any way that I can Format the cells on an Excel sheet without using InterOp library. 有没有办法可以在不使用InterOp库的情况下在Excel工作表上格式化单元格。 (Something like connecting using OleDb connection and formatting) ?? (像使用OleDb连接和格式化连接的东西)?

Please Share Your Knowledge 请分享您的知识

Try using ExcelPlusPlus library from codeplex. 尝试使用codeplex中的ExcelPlusPlus库。 It is not using OleDB 它没有使用OleDB

EPPlus link EPPlus链接

From codeplex: 来自codeplex:

Create advanced Excel 2007/2010 spreadsheets on the server

EPPlus is a .net library that reads and writes Excel 2007/2010 files using the Open Office Xml format (xlsx). 


EPPlus supports:

Cell Ranges 
Cell styling (Border, Color, Fill, Font, Number, Alignments)
Charts
Pictures
Shapes
Comments
Tables
Protection
Encryption
Pivot tables
Data validation
Conditional formatting
VBA
Many more...

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

相关问题 使用C#在Excel中更改MS Excel行颜色 - Change MS Excel Row Colour in Excel using C# 如何检测 C# 中任何 excel 单元格的变化? - how to detect a change in any excel cell in C#? C#Excel宏-如何检查单元格值是否为负并更改其字体颜色? - C# Excel Macro - how to check if cell value is negative and change its font colour? 如果我使用 C# 知道网格单元格位置,如何更改 XAML 网格单元格中存在的矩形的颜色 - How to change the colour of a rectangle present in a XAML grid cell if i know the grid cell position using C# 如何在C#中的单元格(边框)颜色上搜索Excel范围? - How to search an excel range on cell's (border) colour in C#? 哪种方法使用C#从Excel读取单元格? - Which way to read a cell from Excel using C#? 在Excel中使用C#中的条件格式更改单元格颜色 - Cell color change In Excel Using Conditional formatting in C# 如何使用 C# 动态更改 Excel 单元格颜色 - How to Change Excel Cell Color Dynamically using C# 使用C#将单元格地址更改为Excel工作表中的行,列 - Change a cell address to row,column in Excel sheet using C# 通过在 c# 中使用 Syncfusion.XlsIO 将 excel 文件导出到 json 有什么方法可以定义包含空间的 Z099FB995346F339E574 - By using Syncfusion.XlsIO in c# to export excel file to json is there any way to define header cell that contain a space?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM