Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping between Excel and XML file - How to refresh from C#

Tags:

c#

excel

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

like image 694
user338421 Avatar asked Nov 05 '22 13:11

user338421


1 Answers

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#.

  1. In Excel, record a macro that refreshes the XML Mapping.
  2. 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.

like image 51
AMissico Avatar answered Nov 14 '22 23:11

AMissico