Saturday, March 21, 2009

[ASP] Export Data Table As Excel Sheet

There are two ways to accomplish this task:

Way 1 : By using a Javascript
You can find HOW-TO by searching through Google with keyword :  javascript + excel
But this method is not suitable for Firefox or other browsers that do not support ActiveXObject.

Therefore I recommend to use
Way 2: Using Header method
Generate header in the page that you want to export as Excel sheet, with content below:

 <%Response.Write("<meta http-equiv=Content-Type content=text/html;charset=big5>") %>

And of course, you still need to put data you want  to export as Excel sheet under the header.  It's very simple!


Post a Comment