{"id":3597,"date":"2014-03-29T02:05:00","date_gmt":"2014-03-29T02:05:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/exporting-datagridview-data-to-excel-file-in-c-collection-of-common-programming-errors\/"},"modified":"2014-03-29T02:05:00","modified_gmt":"2014-03-29T02:05:00","slug":"exporting-datagridview-data-to-excel-file-in-c-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/exporting-datagridview-data-to-excel-file-in-c-collection-of-common-programming-errors\/","title":{"rendered":"Exporting DataGridView data to Excel file in C#-Collection of common programming errors"},"content":{"rendered":"<p>I need to export data from DataGridView (in my WinForms application) to excel file. I googled some tutorials on the subject, but I&#8217;m having hard time getting any of the available solutions to work.<\/p>\n<p>I started with this tutorial. But when I try to export datagridview to excel file i get Unhandled COMException in:<\/p>\n<pre><code> Microsoft.Office.Interop.Excel.ApplicationClass ExcelApp = new \n Microsoft.Office.Interop.Excel.ApplicationClass();\n<\/code><\/pre>\n<p>I&#8217;ve also tried this tutorial, but with the same result.<\/p>\n<p>Another of the articles I&#8217;ve found and read was this one. Couldn&#8217;t get code to work, probably because I can&#8217;t find <code>Microsoft Excel 12.0 object library<\/code> in the <code>COM tab<\/code> of <code>Add Reference<\/code> dialog.<\/p>\n<p>I&#8217;m using Visual Studio 2010 Ultimate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I need to export data from DataGridView (in my WinForms application) to excel file. I googled some tutorials on the subject, but I&#8217;m having hard time getting any of the available solutions to work. I started with this tutorial. But when I try to export datagridview to excel file i get Unhandled COMException in: Microsoft.Office.Interop.Excel.ApplicationClass [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3597","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3597"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3597\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}