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
Ïà¹ØÎĵµ£º
½ÓÉÏһƪ
ɾ³ýÔ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 ......
ÔںܶàÓ¦ÓÃÖÐÐèÒª×öwindows·þÎñÀ´²Ù×÷Êý¾Ý¿âµÈ²Ù×÷£¬±ÈÈç
£¨1£©Ò»Ð©·Ç³£ÂýµÄÊý¾Ý¿â²Ù×÷£¬²»ÏëÒ»´ÎÐÔÈ¥×ö£¬ÏëÂýÂýµÄͨ¹ý·þÎñ¶¨Ê±È¥×ö£¬±ÈÈ綨ʱΪÊý¾Ý¿â±¸·ÝµÈ
£¨2£©ÔÚ.net RemotingÖÐÀûÓÃwindows·þÎñÀ´×öHost
ÀûÓÃvs.netÎÒÃÇ¿ÉÒÔÔÚ¼¸·ÖÖÓÖ®ÄÚ½¨Á¢Æäwindows·þÎñ£¬·Ç³£¼òµ¥
ÏÂÃæËµÒ»Ï²½Öè
1. н¨Ò»¸öÏîÄ¿
2. ´ÓÒ»¸ö¿É ......
C#ÀûÓÃwebrequest¼ÆËã´ýÏÂÔØµÄÎļþ´óС
string URL = textBox1.Text;
string filetype = URL.Substring(URL.LastIndexOf(".") + 1, (URL.Length - URL.LastIndexOf(".") - 1));
filetypevalue.Text = filetype.ToUpper();
string filename = URL.Substring(URL.LastIn ......
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâÆªÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆÒ»Ï´úÂëÊÔÒ»ÏÂ.ÕâÆªÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1£¬´´½¨µ½·þÎñÆ÷ͬà ......
¸Õ¿ª²©²»¾Ã,¾ÍºÜÏëдµã¶«Î÷,µ«ÊdzöÓÚÖÖÖÖÔÒò¶¼Ã»¶¯ÊÖ¡£ÓÐÁ˲©¿Í×ܲ»ÄÜ¿Õ×Å£¬¾ÍÔÚ×ÁÄ¥×ÅдЩʲô¡£¸ÕºÃѧϰÁË×Ö·û´®µÄһЩ¶«Î÷£¬×öÁËϱʼǸоõ»¹²»´í£¬ÄóöÀ´É¹É¹...
ÏÈ˵˵×Ö·û´®²Ù×÷µÄÐÔÄÜÎÊÌâ¡£C#ÖеÄ×Ö·û´®²Ù×÷£¬ÓõÃÒ²±È½Ï¶à£¬´ó¼Ò¶¼²»Ä°Éú¡£·´Õý¾ÍÊÇÉùÃ÷Ò»¸ö×Ö·û´®±äÁ¿£¬È»º ......