Got an excel spread sheet where I specify mapping to an XML file.
I'd like to open the spread sheet from C# and force refresh the cells mappped to the XML file. -> How can I 开发者_如何学编程do that ? Any dll I need to reference ?
Thanks
Olivier
You have not specified your requirements, but this is fairly easy using the handy "macro recorder" feature of Excel to get the needed "API" and Visual Studio Tools for Office (VSTO) at http://msdn.microsoft.com/en-us/vsto/default.aspx provides the functionality you need in order to use C#.
- In Excel, record a macro that refreshes the XML Mapping.
- In C#,
- Using VSTO, duplicate the macro.
- Using VSTO, create a project, see what assemblies are referenced, add those references to your project, then duplicate the macro.
Obviously, the devil is in the details, but this will get you started.
Have you had a look at VSTO. VSTO allows you to call .NET code and therefore it might be easier to manage what is happening.
Might be worthwhile taking a peek^^
I am not no sure about what you mean by mapping XML file, but you should be able to use excel PIA and invoke calculate() on each sheet, forcing all cells to refresh.
精彩评论