Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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#дXMLµÄ¼òµ¥Àý×Ó

Õâ¸öÀý×ÓÒª°Ñbookstore.xmlÎļþÔö¼ÓÒ»Ìõbook¼Ç¼
1 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="love" ISBN="1234123">
    <title>who am i </title>
    <author>who</author>
   ......

C#ɾ³ýXML½áµãµÄ¼òµ¥Àý×Ó

½ÓÉÏһƪ
ɾ³ýÔ­genreÊôÐÔ£¬É¾³ýleixing=loveµÄËùÓнáµã¡£
1 Ô­xmlÎļþ bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="love" ISBN="1234123">
    <title>who am i </title>
    <author>who</aut ......

C# copydataÏûÏ¢´¦Àí

http://blog.csdn.net/carl2380/archive/2009/11/18/4826973.aspx
¼ò½é:
±¾ÎÄ×ÅÖØ½²ÊöÁËÈç¹ûÓÃWM_COPYDATAÏûÏ¢À´ÊµÏÖÁ½¸ö½ø³ÌÖ®¼ä´«µÝÊý¾Ý.
½ø³ÌÖ®¼äͨѶµÄ¼¸ÖÖ·½·¨:
ÔÚWindows³ÌÐòÖУ¬¸÷¸ö½ø³ÌÖ®¼ä³£³£ÐèÒª½»»»Êý¾Ý£¬½øÐÐÊý¾ÝͨѶ¡£³£Óõķ½·¨ÓÐ
  ʹÓÃÄÚ´æÓ³ÉäÎļþ
  ͨ¹ý¹²ÏíÄÚ´æDLL¹²ÏíÄÚ´æ
  ʹ ......

¡¾×ª¡¿C#´´½¨ÍøÕ¾·½·¨£¨Ò»£©

1¡¢ÒýÓõĿռ䣺
using System.DirectoryServices;
using System.ServiceProcess;
2¡¢µ÷ÓÃ
private void button1_Click(object sender, EventArgs e)
{
String webSiteName = "ĬÈÏÍøÕ¾";
String pathToRoot = @"C:\Inetpub\wwwroot";
CreateWebSite(webSit ......

C#×Ö·û´®Ç³Îö

    ¸Õ¿ª²©²»¾Ã,¾ÍºÜÏëдµã¶«Î÷,µ«ÊdzöÓÚÖÖÖÖÔ­Òò¶¼Ã»¶¯ÊÖ¡£ÓÐÁ˲©¿Í×ܲ»ÄÜ¿Õ×Å£¬¾ÍÔÚ×ÁÄ¥×ÅдЩʲô¡£¸ÕºÃѧϰÁË×Ö·û´®µÄһЩ¶«Î÷£¬×öÁËϱʼǸоõ»¹²»´í£¬ÄóöÀ´É¹É¹...
    ÏÈ˵˵×Ö·û´®²Ù×÷µÄÐÔÄÜÎÊÌâ¡£C#ÖеÄ×Ö·û´®²Ù×÷£¬ÓõÃÒ²±È½Ï¶à£¬´ó¼Ò¶¼²»Ä°Éú¡£·´Õý¾ÍÊÇÉùÃ÷Ò»¸ö×Ö·û´®±äÁ¿£¬È»º ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ