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

asp.net C# ½«Êý¾Ýµ¼³öµ½Execl»ã×Ü


asp.netÖе¼³öExeclµÄ·½·¨£º
ÔÚasp.netÖе¼³öExeclÓÐÁ½ÖÖ·½·¨£¬Ò»ÖÖÊǽ«µ¼³öµÄÎļþ´æ·ÅÔÚ·þÎñÆ÷ij¸öÎļþ¼ÐÏÂÃ棬Ȼºó½«ÎļþµØÖ·Êä³öÔÚä¯ÀÀÆ÷ÉÏ£»Ò»ÖÖÊǽ«ÎļþÖ±½Ó½«ÎļþÊä³öÁ÷д¸øä¯ÀÀÆ÷¡£ÔÚResponseÊä³öʱ£¬t·Ö¸ôµÄÊý¾Ý£¬µ¼³öexeclʱ£¬µÈ¼ÛÓÚ·ÖÁУ¬nµÈ¼ÛÓÚ»»ÐС£
1¡¢½«Õû¸öhtmlÈ«²¿Êä³öexecl
´Ë·¨½«htmlÖÐËùÓеÄÄÚÈÝ£¬Èç°´Å¥£¬±í¸ñ£¬Í¼Æ¬µÈÈ«²¿Êä³öµ½ExeclÖС£
    Response.Clear();    
    Response.Buffer=   true;    
    Response.AppendHeader("Content-Disposition","attachment;filename="+DateTime.Now.ToString("yyyyMMdd")+".xls");          
    Response.ContentEncoding=System.Text.Encoding.UTF8;  
    Response.ContentType   =   "application/vnd.ms-excel";  
    this.EnableViewState   =   false;  
ÕâÀïÎÒÃÇÀûÓÃÁËContentTypeÊôÐÔ£¬ËüĬÈϵÄÊôÐÔΪtext/html£¬Õâʱ½«Êä³öΪ³¬Îı¾£¬¼´ÎÒÃdz£¼ûµÄÍøÒ³¸ñʽµ½¿Í»§¶Ë£¬Èç¹û¸ÄΪms-excel½«½«Êä³öexcel¸ñʽ£¬Ò²¾ÍÊÇ˵ÒÔµç×Ó±í¸ñµÄ¸ñʽÊä³öµ½¿Í»§¶Ë£¬Õâʱä¯ÀÀÆ÷½«ÌáʾÄãÏÂÔر£´æ¡£ContentTypeµÄÊôÐÔ»¹°üÀ¨£ºimage/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword ¡£Í¬Àí£¬ÎÒÃÇÒ²¿ÉÒÔÊä³ö(µ¼³ö)ͼƬ¡¢wordÎĵµµÈ¡£ÏÂÃæµÄ·½·¨£¬Ò²¾ùÓÃÁËÕâ¸öÊôÐÔ¡£
2¡¢½«DataGrid¿Ø¼þÖеÄÊý¾Ýµ¼³öExecl
ÉÏÊö·½·¨ËäȻʵÏÖÁ˵¼³öµÄ¹¦ÄÜ£¬µ«Í¬Ê±°Ñ°´Å¥¡¢·ÖÒ³¿òµÈhtmlÖеÄËùÓÐÊä³öÐÅÏ¢µ¼Á˽øÈ¥¡£¶øÎÒÃÇÒ»°ãÒªµ¼³öµÄÊÇÊý¾Ý£¬DataGrid¿Ø¼þÉϵÄÊý¾Ý¡£
System.Web.UI.Control ctl=this.DataGrid1;
//DataGrid1ÊÇÄãÔÚ´°ÌåÖÐÍϷŵĿؼþ
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=Excel.xls");
HttpContext.Current.Response.Charset ="UTF-8";    
HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType ="application/ms-excel";
ctl.Page.EnableViewState =false;   
System.IO.StringWriter tw = new System.IO.StringWriter() ;
System.Web.UI.Ht


Ïà¹ØÎĵµ£º

ASP.NETÖÐÈÃͼƬÒÔ¶þ½øÖƵÄÐÎʽ´æ´¢ÔÚÊý¾Ý¿âÖÐ


 ½ñÔçÓиöÍøÓÑÎʵ½ÎÒÕâÎÊÌ⣬ÒÔÇ°ÎÒ¶¼ÊÇÖ±½ÓÔÚÊý¾Ý¿âÖдæÎļþÃûµÄ£¬»¹Ã»ÓÐÊÔ¹ý´æ´¢ÕûÕÅͼƬµ½Êý¾Ý¿âÖУ¬ÉÏÍøËÑË÷ÁËһϣ¬×Ô¼ºÓÖ²âÊÔÁËÒ»·¬£¬´úÂëÈçÏ£º
½¨Á¢±£´æͼƬµÄ±íµÄSQLÓï¾ä£º
 
Sql´úÂë < width="14" height="15" src="javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://w ......

javaÖеÄsuperÓëc#ÖеÄbase


C#ÖжÔbaseµÄ½âÊÍ(Òý×ÔMSDN):
base ¹Ø¼ü×ÖÓÃÓÚ´ÓÅÉÉúÀàÖзÃÎÊ»ùÀàµÄ³ÉÔ±£º
µ÷ÓûùÀàÉÏÒѱ»ÆäËû·½·¨ÖØдµÄ·½·¨¡£
Ö¸¶¨´´½¨ÅÉÉúÀàʵÀýʱӦµ÷ÓõĻùÀ๹Ô캯Êý¡£
»ùÀà·ÃÎÊÖ»ÄÜÔÚ¹¹Ô캯Êý¡¢ÊµÀý·½·¨»òʵÀýÊôÐÔ·ÃÎÊÆ÷ÖнøÐС£
´Ó¾²Ì¬·½·¨ÖÐʹÓà base ¹Ø¼ü×ÖÊÇ´íÎóµÄ¡£
ÔÚ±¾ÀýÖУ¬»ùÀà Person ºÍÅÉÉúÀà Employee ¶¼ÓÐÒ»¸ö ......

c#ºÍjavascript½»»¥

ÔÚasp.net開發ÖУ¬經³£會Óõ½áą́ºÍǰ̨µÄ½»»¥£¬¾Í´Ë總結ÁËÒ»點c#ºÍjavascriptÏ໥²Ù×÷µÄ·½·¨
¡¡¡¡1.ÔÚáą́c#´ú碼ÖÐ調ÓÃjacascriptµÄ·½·¨
¡¡¡¡javascript´ú碼£º
¡¡¡¡<script type="text/javascript" language="javascript">
¡¡¡¡function test()
¡ ......

WCF Óë Asp.net Web service ±È½Ï

Ê×Ïȼòµ¥½éÉÜһϠWCF ÊÇʲô£¬È»ºóÔÙ¶Ô WCF ºÍ Asp.net Web service ×ö¸ö±È½Ï¡£
    Windows Communication Foundation (WCF) ÊÇÓÃÓÚ¹¹½¨ÃæÏò·þÎñµÄÓ¦ÓóÌÐòµÄ¿ò¼Ü¡£½èÖú WCF£¬¿ÉÒÔ½«Êý¾Ý×÷ΪÒì²½ÏûÏ¢´ÓÒ»¸ö·þÎñÖÕ½áµã·¢ËÍÖÁÁíÒ»¸ö·þÎñÖÕ½áµã¡£·þÎñÖÕ½áµã¿ÉÒÔÊÇÓÉ IIS ³ÐÔصijÖÐø¿ÉÓõķþÎñµÄÒ»²¿·Ö£¬Ò²¿É ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ