[solved] C# how to change the color of windows excel-sheet cells background color and forecolor

Problem A

An issue with the Windows c# excel sheet cell font style not changing to ‘black’ color

Problem B

Highlighting import columns header in an excel sheet using c# winforms

excel cell color change

Solution

The Microsoft.Office.Interop.Excel package allows us to access the excel to API objects.

In solution Explorer, Right click on project name and choose “Manage Nuget packages” option to Add new Microsoft.Office.Interop.Excel  new package by Microsoft then click OK, if you have not installed yet.

Microsoft.Office.Interop.Excel

The ClosedXML package allows us to access the excel to API objects.

In solution Explorer, Right click on project name and choose “Manage Nuget packages” option to Add new ClosedXML new package by Microsoft then click OK, if you have not installed yet.

ClosedXML

Do copy paste the below code

Conclusion

The Microsoft.Office.Interop.Excel package allows us access excel objects and change the behaviour of the cells style. XLColor.FromTheme(XLThemeColor.Text1); can be used set the cell text font color style as black.

Shivaraju M

Over 3+ years experience in IT industry, good knowledge in . Net-based Web applications, windows applications, web services, and SPAs. I have played multiple roles related to technical delivery in multiple domains while working on over 10+ technologies. I am currently focused on continuous improvement and agile project management.

Post a Comment

Previous Post Next Post