简体   繁体   中英

adding microsoft.office.interop.excel to visual studio 2015 does not work

I currently making an inventory management system for thee company I am currently hired in. The system requires me to export data from DataGridView to Excel. I have tried clicking "Add Reference" to my references in solution explorer and selecting Microsoft.Office.Interop.Excel but after I click OK it still is not in my references. I tried it in my code but then I get this error:

Error CS0234 The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

There are other methods of generation Excel files from C# without using the ineterop. One of the best ways is Open XML

It is not good to use this method. What if on somebody's computer there is not Excel? Try open source lib as EPPlus or as @Sagi mentioned Open XML

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM