I have a tool that generates reports in Excel using Interop and using a lot of conditional formatting data bars.
I found that the performance hit was HUGE when adding the conditional formats through Interop.
The question is: Is there a way to enhance the performance of Interop conditional formatting?
And today, after searching a lot and even considering rewriting my code entirely to use different OpenXML libraries, I finally found the solution in MSDN:
Worksheet.EnableFormatConditionsCalculation Property
Just add this line of code before you add conditional formats with Interop, and you’ll notice a HUGE performance boost in your application:
Hope this helps others, since I’ve been looking for this for ages and I never found it until today. 🙂
Note: Apparently, you don’t need to set this property back to true before saving the Excel. The Excels I saved so far have the conditional format calculations enabled when I open them, even I didn’t set this back to true when saving them with Interop.