Determining Excel BG color in C#
I need to write an app in C# that opens an Excel file which has rows that have either ayellow, blue or just the plain white background color, then only returns the values in Column 'A' that does NOT have a white back开发者_开发技巧ground(just yellow or blue values in Column A should be returned).
I found code on SO to get the data from the Spreadsheet, but I don't have any info on the background color.
I can confirm, Chris Walsh's answer is good. Definitely use the Microsoft Office Primary Interop Assemblies: http://www.microsoft.com/download/en/details.aspx?id=3508
You can also take the road of Visual Studio Tools for Office but I recommend the former, it's easier and cleaner.
Here's another code example that shows how you can SET a cell color, so you have a good sample of how to access that property.
http://forums.asp.net/t/1310118.aspx/1?Changing+Cell+color+of+excel+sheet+programatically+
精彩评论