Excel Automation using C# dynamics
I'm currently working on a project in Silverlight 4, where I need to export some data to Excel files. Using the dynamic keyword and the AutomationFactory, I can automate Excel w开发者_如何学Goithout problems.
But now I'd like to use some Excel Enumerations - how can I do that? I haven't referenced any Interop-DLL in my project, I'm just using dynamics.
Example:
dynamic xlApp = null;
//works without problems
xlApp = AutomationFactory.CreateObject("Excel.Application");
xlApp.Visible = true;
//doesn't work - 'Excel' does not exist, there are no referenced Interop-DLLs
xlApp.Calculation = Excel.XlCalculation.xlCaculationManual
This might solve your problem:
//set the Calculation to Manual
xlApp.Calculation = -4135
http://social.msdn.microsoft.com/Forums/en-US/exceldev/thread/13d1a55e-a138-4989-a4cd-2d986851a313/
精彩评论