Home » excel » asp.net – Is there Any way to change the colour of an Excel Cell using C#?

asp.net – Is there Any way to change the colour of an Excel Cell using C#?

Posted by: admin May 14, 2020 Leave a comment

Questions:

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.

Currently I have successfully Implemented this functionality using Excel 12.0 Object Library.
But the problem is that I need to improve performance. InterOp library is very slower than what I expected.

Is there any way that I can Format the cells on an Excel sheet without using InterOp library.
(Something like connecting using OleDb connection and formatting) ??

Please Share Your Knowledge

How to&Answers:

Try using ExcelPlusPlus library from codeplex. It is not using OleDB

EPPlus link

From 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...