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

C#µ¼³öxls,word,ͼƬ¼°ÑùʽÎÊÌâ

public void ExportControl(System.Web.UI.Control source, string DocumentType, string filename)
{
//ÉèÖÃHttpµÄÍ·ÐÅÏ¢,±àÂë¸ñʽ
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
if (DocumentType.ToLower() == "excel")
{
//Excel
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename + ".xls", System.Text.Encoding.UTF8));
HttpContext.Current.Response.ContentType = "application/ms-excel";
}
else if (DocumentType.ToLower() == "word")
{
//Word
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename + ".doc", System.Text.Encoding.UTF8));
HttpContext.Current.Response.ContentType = "application/ms-word";
}
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.HeaderEncoding=System.Text.Encoding.UTF8;
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
//¹Ø±Õ¿Ø¼þµÄÊÓͼ״̬
source.Page.EnableViewState = false;
//³õʼ»¯HtmlWriter
System.IO.StringWriter writer = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer);
source.RenderControl(htmlWriter);
//Êä³ö
HttpContext.Current.Response.Write(writer.ToString());
HttpContext.Current.Response.End();
}
    //·½·¨ExportControl(System.Web.UI.Control source, string DocumentType,string filename)ÖÐ
    //µÚÒ»¸ö²ÎÊýsource±íʾµ¼³öµÄÒ³Ãæ»ò¿Ø¼þÃû,µ±Îªdata


Ïà¹ØÎĵµ£º

C#——C#ÖÐC/C++³ÌÐòԱҪעÒâµÄÎÊÌâ


1¡¢C/C++³ÌÐòÔ±Çë×¢Ò⣬²»ÄÜÔÚcaseÓï¾ä²»Îª¿Õʱ“ÏòÏÂÖ´ÐД¡£
2¡¢ÖµÀàÐͺÍÒýÓÃÀàÐÍÖ®¼äµÄÇø±ð£ºC#µÄ»ù±¾ÀàÐÍ£¨int£¬charµÈ£©¶¼ÊÇÖµÀàÐÍ£¬ÊÇÔÚÕ»Öд´½¨µÄ¡£¶ø¶ÔÏóÊÇÒýÓÃÀàÐÍ£¬´´½¨ÓÚ¶ÑÖУ¬ÐèҪʹÓùؼü×Önew¡£
3¡¢ÔÚC#ÖÐͨ¹ýʵÀý·ÃÎʾ²Ì¬·½·¨»ò³ÉÔ±±äÁ¿ÊDz»ºÏ·¨µÄ£¬»áÉú³É±àÒëÆ÷´íÎó¡£µ«ÊÇÎÒÃÇ¿ÉÒÔͨ¹ýÉùÃ÷Ëû ......

asp.net(c#) ÏÂSQL´æ´¢¹ý³ÌʹÓÃÏêϸʵÀý

¼ÇÈ¡¼Ç¼¼¯
create procedure getArticle
as
select * from Article_Content
GO
asp.net µ÷Ó÷½·¨
  SqlConnection Conn = new SqlConnection();
        Conn.ConnectionString = Data.Connstr();
        Conn.Open();
  ......

C#¶àÏß³ÌÓëUIÏìÓ¦

Èí¼þ½çÃæµÄÏìÓ¦ÌØÐÔÊÇÅжÏÒ»¿îÈí¼þµÄ·Ç³£ÖØÒªµÄ·½Ãæ¡£Ò»°ãÀ´Ëµ£¬²»¹ÜÄãÈí¼þ¹¦ÄÜ×öµÃÓжàÃ´ÆæÃÈç¹ûÈí¼þÓÐÒ»µãµãËÀ»úµÄ¸Ð¾õ¶¼»áÈÃÓû§¸Ðµ½ºÜÌÖÑᣬÉõÖÁ»³ÒÉÄãÈí¼þÀïÊÇ·ñ²ØÓиü´óµÄÎÊÌâ¡£
ÒªÌá¸ß½çÃæµÄÏìÓ¦ÌØÐÔ£¬×îºÃµÄ°ì·¨Äª¹ýÓÚʹÓöàỊ̈߳¬²¢°Ñ³ÊÏÖ½çÃæµÄÏ̶߳ÀÁ¢³öÀ´¡£ÒÔǰֻÓÐʹÓÃC++²ÅÄÜʵÏֵĶàÏ̹߳¦ÄÜ£¬ÏÖÔÚÔÚ.Ne ......

ÔÚC#.netÖÐÈçºÎ²Ù×÷XML


ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâÆªÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆÒ»Ï´úÂëÊÔÒ»ÏÂ.ÕâÆªÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1£¬´´½¨µ½·þÎñÆ÷ͬà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ