随笔分类 -  C#

摘要:1 protected override void Render(HtmlTextWriter writer) 2 { 3 System.IO.StringWriter html = new System.IO.StringWriter(); 4 System.Web.UI.HtmlTextWriter tw = new System.Web.UI.HtmlTextWriter(html); 5 base.Render(tw); 6 string Temp = html.ToString(); 7 string s1 = string.Empty, s2 = string.Emp... 阅读全文
posted @ 2014-04-04 16:09 fycaijing 阅读(190) 评论(0) 推荐(0)
摘要:1 byte[] fileContent =null;//二进制文件 2 Response.Clear(); 3 Response.ClearHeaders(); 4 Encoding code = Encoding.GetEncoding("gb2312"); 5 Response.ContentEncoding = code; 6 Response.HeaderEncoding = code;//这句很重要 7 Response.AddHeader("Content-Disposition", "attachment,inline;file 阅读全文
posted @ 2014-02-26 09:01 fycaijing 阅读(147) 评论(0) 推荐(0)
摘要:1 public string TableContent() 2 { 3 IList<ActionListInfo> lt = cache.Get(listCache) as IList<ActionListInfo>; 4 StringBuilder builder = new StringBuilder(); 5 if (lt != null) 6 { 7 System.Reflection.PropertyInfo[] myPropertyInfo = l... 阅读全文
posted @ 2012-06-15 13:50 fycaijing 阅读(309) 评论(0) 推荐(0)
摘要:上篇写的那个那个导出Excel的方法导出Excel的时间慢,后面想了个别的方法,导出Excel的时间很快 1 public string CreateAdvExcel(IList<DocAdvInfo> lt) 2 { 3 StringBuilder builder = new StringBuilder(); 4 Random rn = new Random(); 5 string name = rn.Next(9999) + ".xls"; 6 string path = Ser... 阅读全文
posted @ 2012-04-24 15:18 fycaijing 阅读(2934) 评论(0) 推荐(0)
摘要:1 /// <summary> 2 /// 下载文档 3 /// </summary> 4 /// <returns></returns> 5 public ActionResult download() 6 { 7 WebClient client = new WebClient(); 8 int id = Request.QueryString["id"].ToInteger(); 9 DocumentRegisterInfo info... 阅读全文
posted @ 2012-04-13 12:52 fycaijing 阅读(351) 评论(0) 推荐(0)
摘要:没有权限 设置权限WebClient client=new WebClient();//NetworkCredential credentials = new NetworkCredential("名字", "密码");//client.Credentials = credentials;未能为 SSL/TLS 安全通道建立信任的解决办法 最简单的办法是:1,先加入命名空间:using System.Net.Security;using System.Security.Authentication;using System.Security.Crypto 阅读全文
posted @ 2012-04-13 12:48 fycaijing 阅读(16367) 评论(0) 推荐(1)
摘要:1 /// <summary> 2 /// 文档转换成swf 3 /// </summary> 4 /// <param name="path">被转换文件的路径</param> 5 /// <param name="oldfile">被转换文件名</param> 6 /// <returns></returns> 7 public void GetCMDOutString(string path, string oldfile,string swfname) 阅读全文
posted @ 2012-04-13 12:41 fycaijing 阅读(391) 评论(0) 推荐(0)
摘要://创建xml public ActionResult XML() { SearchArticle search = new SearchArticle { SearchType = SearchTypeEnum.Top, Top = 4, Status = StatusEnum.Active, }; IList<ArticleInfo> list = article.SearchA... 阅读全文
posted @ 2012-04-11 15:40 fycaijing 阅读(416) 评论(0) 推荐(0)
摘要:/// <summary> /// 创建Excel /// </summary> /// <returns></returns> public object CreateExcel(IList<DocumentRegisterInfo> list) { Application myExcel = new Application(); myExcel.Application.Workbooks.Add(true); myExcel.Visible = true; Type type = list[0].GetType(); Proper 阅读全文
posted @ 2012-03-16 12:58 fycaijing 阅读(509) 评论(0) 推荐(0)