0

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?)

Jon Grant
  • 11,369
  • 2
  • 37
  • 58
randomGuy
  • 3
  • 1

2 Answers2

1

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

Sagi
  • 981
  • 11
  • 15
1

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

Lucas_Poland
  • 48
  • 10