I used the following C# code. Which can be place within a LinkButton, or Button click event handler:
byte[] data = Encoding.UTF8.GetBytes("
Column 1 | Column 2 |
---|---|
Data 1 | Data 2 |
Data 3 | Data 4 |
As you can see I've used an HTML table as the source of the data. You can also style this and Excel will display it correctly using any CSS you provide.
The name of the file is also set to "test.xls" using the header content-disposition.
No comments:
Post a Comment