Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 8
    No, this generates HTML marked as an Excel file rather than a true Excel file. Yes, Excel itself will open that OK but other programs that consume spreadsheets - including Microsoft's free Excel viewer, for example - won't accept it. You'd do better to create a real Excel file using one of the libraries here.
    – Rup
    Commented Apr 28, 2011 at 11:46
  • You should also use System.Net.Mime.ContentDisposition to generate the content-disposition header text rather than a string append - that'll cope with filenames that contains spaces etc. correctly.
    – Rup
    Commented Apr 28, 2011 at 11:48
  • GridViewExportUtil only for Web. And for Windows Forms, WPF, Console, Service Windows, Unit Test or Addin ?
    – Kiquenet
    Commented Dec 11, 2020 at 15:42