Asp½«²éѯ½á¹ûµ¼³öµ½excelÀï
ÊÇOfficeµÄOWC°æ±¾ÎÊÌâ¡£2000£¬2002XP£¬2003¸÷²»Ïàͬ£¬¼ÓÈëOfficeµÄ°æ±¾¼ì²é¼´¿É£¬ÍêÕû´úÂëÈçÏ£º
<script language="javascript">
function exportExcel(atblData,dirPath)
{
//alert(dirPath);
if (typeof(atblData)=="undefined"||typeof(atblData)=="unknow")
{
alert("ûÓÐÊý¾Ý¿ÉÒÔµ¼³ö£¡");
return;
}
var mysheet;
var off2000=false;
var off2002xp=false;
var off2003=false;
//office2003
try {
mysheet=new ActiveXObject("OWC11.Spreadsheet");
off2003=true;
}
catch(e) { }
//office2002-xp
if(!off2003)
{
try {
mysheet=new ActiveXObject("OWC10.Spreadsheet");
off2002xp=true;
}
catch(e) {}
}
//office 2000
&
Ïà¹ØÎĵµ£º
ĬÈÏÇé¿öÏ£¬ÔÚÒ³»Ø·¢µ½·þÎñÆ÷ʱ¡¢Ò³³õʼ»¯Ö®ºó£¨¼´ÊÓͼ״̬ºÍ»Ø·¢Êý¾ÝÒÑ´¦ÀíÖ®ºó£©ºÍµ÷ÓÃʼþ´¦Àí´úÂë֮ǰ£¬ASP.NET ÑéÖ¤¿Ø¼þ½«×Ô¶¯Ö´ÐÐÑéÖ¤¡£Èç¹ûä¯ÀÀÆ÷Ö§³Ö¿Í»§¶Ë½Å±¾£¬¿Ø¼þÒ²¿ÉÒÔÔÚä¯ÀÀÆ÷ÖÐÖ´ÐÐÑéÖ¤¡£
µ«ÊÇ£¬ÓÐʱÄú¿ÉÄÜÐèÒªÒÔ±à³Ì·½Ê½Ö´ÐÐÑéÖ¤¡£ÔÚÒÔÏÂÇé¿öÏ£¬Äú¿ÉÄÜÐèҪͨ¹ý±à³ÌÀ´½ ......
Ò»¡¢Application¶ÔÏó
Application¶ÔÏóÊǸöÓ¦ÓóÌÐò¼¶µÄ¶ÔÏó£¬ÓÃÀ´ÔÚËùÓÐÓû§¼ä¹²ÏíÐÅÏ¢£¬²¢¿ÉÒÔÔÚWebÓ¦ÓóÌÐòÔËÐÐÆÚ¼ä³Ö¾ÃµØ±£³ÖÊý¾Ý¡£
ApplicationµÄÊôÐÔ£º
Application¶ÔÏóûÓÐÄÚÖõÄÊôÐÔ£¬µ«ÊÇÎÒÃÇ¿ÉÒÔ×ÔÐд´½¨ÆäÊôÐÔ¡£
<% Application(”ÊôÐÔÃû”)=Öµ %>
´ó²¿·ÖApplication±äÁ¿¶¼¡¡´æ·ÅÔÚCon ......
·½·¨Ò»£º
<%
' ============================================
' ¸ñʽ»¯Ê±¼ä(ÏÔʾ)
' ²ÎÊý£ºn_Flag
' 1:"yyyy-mm-dd hh:mm:ss"
' 2:"yyyy-mm-dd"
' 3:"hh:mm:ss"
' 4:"yyyyÄêmmÔÂddÈÕ"
' 5:"yyyymmdd"
' &nb ......
×î½ü×öÒ»¸öÓÃasp×öµÄÍøÕ¾ºǫ́µÄÊý¾Ýµ¼³ö¹¦ÄÜʱ,google,baiduÁ˺ܶà,µ«ÊǶàÊý¶¼ÊÇתÔØ,´úÂë´ó¸Å¶¼Ò»Ñù,µ«ÊǾÍÊDZ¨´í,×îºóÓÐÈË˵ͨ¹ýÉèÖÃMIMEÀàÐͺͽ¨Á¢Ä£°å,×îºóÕûÀí,²âÊÔÎÊÌâÖÕÓÚ½â¾ö.¹Ø¼üµÄµØ·½ÓÐÒÔϼ¸µã:
1):MIMEÀàÐÍÒªÉèÖÃÕýÈ·,ÈçÒª°ÑDBÖбí(»ò±íÖÐÖ¸¶¨×Ö¶Î)µÄÊý¾Ýµ¼³ö³Éexel¸ñʽʱ,Í·²¿µÄMEMIÀàÐ͵ÄÉèÖÃÊÇ:
<%
......
Excelµ¼³öº¯Êý
<%
Sub ExportToExcel
Response.ContentType = "application/vnd.ms-Excel"
Response.AddHeader "Content-Disposition", "attachment;Filename=Results.xls"
Response.Write ......