Reputation: 411
I am learning to develop universal windows 10 app using visual studio 2015. I want to implement a function to create an Excel file then write data in this excel file, in my app. I try to develop it in C# adding reference Microsoft.Office.Interop.Excel. Generate Error: Missing compiler required member System.Runtime.InteropServices.LCIDConversionAttribute Search this error and find windows store apps doesn't support Microsoft.Office.Interop.Excel. I am not able to create Excel file. I do not want to use any commercial library (like syncfusion) for this. How Can I create Excel file in Universal Windows App or in Window storeApp? Please request to tell me any solution.
Thanks
Upvotes: 0
Views: 1374
Reputation: 8670
You will not be able to use the Excel interop libraries in a Windows 10 Universal App. The interop is only available on Windows Desktop, and also requires a dependency on another software (Excel) to be installed on the machine. Both of those are somewhat against the spirit (and more importantly, the technology) of the Universal app.
That being said: If all you need is to generate a file (rather than display it), the general solution is to use something like the OpenXML SDK, which also has the advantage of not requiring Excel on the running machine. Admittedly, the OpenXML SDK doesn't look like it's available for the Universal platform either (see here), but you may find a 3rd-party component that is. Or, if you are OK with requiring internet connectivity, you could create a web service that you send data to, and that processes it and creates the file on your behalf (quite a common pattern, with the additional advantage of protecting your intellectual property behind your own web server). The Interop libraries are much more about automating user actions, are were initially build more for use with VBA/VSTO/COM add-ins, where the interactivity was very much part of the experience. If all you're doing is using the Interop to drive the creation of documents, OpenXML would be the better way to go.
Hope this helps!
Upvotes: 1