Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp µ¼³öexcelÊý¾Ý fso µ¥Ôª¸ñ¸ñʽ

<!--#include file="../conn.asp"-->
<%
dim s,sql,filename,fs,myfile,x
Set fs = server.CreateObject("scripting.filesystemobject")
'--¼ÙÉèÄãÏëÈÃÉú³ÉµÄEXCELÎļþ×öÈçϵĴæ·Å
filename = Server.MapPath("users.xls")
'--Èç¹ûÔ­À´µÄEXCELÎļþ´æÔڵϰɾ³ýËü
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
'--´´½¨EXCELÎļþ
set myfile = fs.CreateTextFile(filename,true)
'Set rs = Server.CreateObject("ADODB.Recordset")
'--´ÓÊý¾Ý¿âÖаÑÄãÏë·Åµ½EXCELÖеÄÊý¾Ý²é³öÀ´
'sql = "select * from Tb_Execl order by id desc"
'rs.Open sql,conn
StartTime = Request("StartTime")
EndTime = Request("EndTime")
StartEndTime = "AddTime between #"& StartTime &" 00:00:00# and #"& EndTime &" 23:59:59#"
strSql = "select * from myeky_myusr "
Set rstData =conn.execute(strSql)
if not rstData.EOF and not rstData.BOF then
dim trLine,responsestr
strLine=""
For each x in rstData.fields
strLine = strLine & x.name & chr(9)
Next
'--½«±íµÄÁÐÃûÏÈдÈëEXCEL
myfile.writeline strLine
Do while Not rstData.EOF
strLine=""
for each x in rstData.Fields
strLine = strLine & x.value & chr(9)
next
myfile.writeline strLine
rstData.MoveNext
loop
end if
Response.Write "Éú³ÉEXCELÎļþ³É¹¦£¬µã»÷ <a href=""users.xls"" target=""_blank"">ÏÂÔØ </a>£¡"
rstData.Close
set rstData = nothing
Conn.Close
Set Conn = nothing
%>
ÎÊÌ⣺
Éú³ÉExcelÎļþÖеÄÊý¾ÝÈ磺ÈÕÆÚʱ¼äÐÍ Ä¬ÈÏÏÔʾÁË8¸ö# ; ֵȫÊÇÊý×Ö³¬³¤ºó20071022130515ÀíÓ¦Õý³£ÏÔʾ20071022130515£¬Ä¬ÈÏÏÔʾ£º2.0071e+13;
ÈçºÎµ¼³öExcelÎļþºó¡£ÈÕÆÚÐÍĬÈÏÏÔʾ2007-10-23¶ø·Ç8¸ö#£¬ÊýÖµ³¬³¤ÏÔʾÕý³£ÄØ¡£
1,µ¼³öµÄʱºòÈçºÎ ÉèÖõ¼³ö µ¥Ôª¸ñ¸ñʽ
2,ÈçºÎ¿ØÖÆÁпíÁиß;
3,ÈçºÎÔÚµ¼³öʱºÏ²¢µ¥Ôª¸ñ;
Õâ¸öÎÊÌâµÚ1¸ö»Ø´ð£º
Êý×Ö¼ÓÉÏ',¿ÉÒÔÕý³£ÏÔʾȫ²¿Êý×Ö
ÆäËûÔÚVBÀïд¹ý£º
Dim mExApp As Excel.Application 'Ó¦ÓÃ
Dim mExBook As Excel.Workbook '¹¤×÷±¡
Dim mExSheet As Excel.Worksheet '¹¤×÷±í
Õâ¸öÎÊÌâµÚ2¸ö»Ø´ð£º
Set mExApp = CreateObject("Excel.Application") '¶¨ÒåXls


Ïà¹ØÎĵµ£º

aspÍøÕ¾Îļþ¼ÐȨÏÞÉèÖÃ

ÒÔwin2003²Ù×÷ϵͳ£¬Ó²Å̲ÉÓÃNTFSÎļþϵͳ¡£ÍøÕ¾µÄȨÏÞÉèÖðüº¬Á½²¿·Ö£ºÖ÷ÒªÊÇÍøÕ¾Îļþ¼ÐÓëÎļþµÄ·ÃÎÊȨÏÞ£¬Æä´ÎÊÇIISÖеÄinternetÄäÃûÓû§µÄ·ÃÎÊȨÏÞ¡£
Ò»¡¢ÍøÕ¾Îļþ¼ÐÓëÎļþ·ÃÎÊȨÏÞµÄÉèÖÃ
¼ÙÉèASPÍøÕ¾ÔÚÒÔÏÂÎļþ¼ÐÖУºweb ¡¢bbs£¬ÎÒÃÇ³ÆÆäÎªÍøÕ¾¸ùÎļþ¼Ð¡£
1¡¢ÏàͬµÄÉèÖÃ
£¨1£©±¾µØÓû§Ò»°ã¶¼Òª¶ÔÕ¾µãÄÚµÄÎļþ¼ÐºÍÎÄ ......

ÓÃISAPI_RewriteʵÏÖaspα¾²Ì¬

ASPÍøÕ¾³ÌÐòÔÚ¹úÄÚÔËÓúܹã,µ«ÊÇÀàËÆÓÚ im286.asp?id=20050307213811ÕâÑùµÄURLÓе㲻ÀûÓÚËÑË÷ÒýÇæµÄÊÕ¼,Ò²¾ÍÊÇ˵²»·ûºÏÓѺÃURL(URLs- Friendly)µÄ±ê×¼,ÄÇôÎÒÃÇÓÃISAPI_Rewrite´òÔìÒ»¸öClean URL,
1.ÏÂÔØISAPI_Rewrite.ISAPI_Rewrite ·Ö¾«¼ò(Lite)ºÍÍêÈ«(Full)°æ.¾«¼ò°æ²»Ö§³Ö¶Ôÿ¸öÐéÄâÖ÷»úÕ¾µã½øÐÐÖØÐ´,Ö»ÄܽøÐÐÈ«¾Ö´¦À ......

ASP excelµ¼³ö/µ¼ÈëAccessÊý¾Ý¿â(´úÂë+ʵÀýÏÂÔØ)

Excelµ¼³öº¯Êý
<%
Sub   ExportToExcel    
Response.ContentType   =   "application/vnd.ms-Excel"  
Response.AddHeader   "Content-Disposition",   "attachment;Filename=Results.xls"  
Response.Write  ......

Asp½«²éѯ½á¹ûµ¼³öµ½excelÀï

ÊÇOfficeµÄOWC°æ±¾ÎÊÌâ¡£2000£¬2002XP£¬2003¸÷²»Ïàͬ£¬¼ÓÈëOfficeµÄ°æ±¾¼ì²é¼´¿É£¬ÍêÕû´úÂëÈçÏ£º
<script language="javascript">
function exportExcel(atblData,dirPath)
{
//alert(dirPath);
if (typeof(atblData)=="undefined"||typeof(atblData)=="unknow")
     {
  & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ