asp.net 导出Excel/Word
asp.net中导出有很多方法。其中比较推荐的兼容导出是导出为word/excel兼容的mhtml格式并设置流格式为word或excel。
这中方法的好处是可以建立一个通用的库。本文中提出了一个通用的导出类,实践中使用效果较好。(ps,html解析类写的比较仓促,各位如有兴趣可重写一下~)
///
///@Author Simsure
///@Version 1.0
///
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Net;
using System.IO;
/// <summary>
///MHtmlDocument 的摘要说明
/// </summary>
public class MHtmlDocument
{
protected const string _NEXT_PART = "------=_NextPart_WIND";
protected const string _4NEXT_PART = "----=_NextPart_WIND";
private const string WIND_SESSION_ID = "wind.sessionid";
protected string _encoding = "utf-8";
protected string _pageVirutalPath;
protected string _rootHttpVirtualPath;
protected bool _enableBase64 = false;
protected HtmlDocument _baseDocument;
protected HttpRequest _request;
protected HttpResponse _response;
protected static readonly log4net.ILog _log = log4net.LogManager.GetLogger("MHtmlDocument");
public string Encoding
{
get { return _encoding; }
}
public string RootHttpVirtualPath
{
get { return _rootHttpVirtualPath; }
}
public string PageVirtualPath
{
get { return _pageVirutalPath; }
}
public bool EnableBase64
{
get { return _enableBase64; }
set { _enableBase6
相关文档:
帮人看一个网站,是ghost克隆后出现空白故障,无论重装IIS还是NETFrameWork都不能正常解析aspx文件一样,遇到aspx显示就是空白页面。
最后发现global.aspx的application_error处理中把错误信息擦除了,修改回来让它显示具体错误。
发现无法csc写入dll文件到临时目录。
解决方法,赋予NetService用户完全控制权限,在%win ......
http://files.cnblogs.com/chengulv/SoftRegion.rar
Microsoft .Net的应用程序的代码文件,与Java生成的文件类似,它们都没有本地代码,而是一种类似于汇编的代码。这样,只要有合适的工具,就可以完整的把别人写出来的程序反编译成自己需要的程序文件。
我所知道的.Net下的反汇编程序是Salamander 和 Refelector 两个工 ......
1.获取图片宽度和高度
1.您可以使用 System.Drawing.Image 类
System.Drawing.Image img = System.Drawing.Image.fromFile(Server.MapPath("example.gif"));
int width = img.Width;
int height = img.Height;
img.Dispose();
但是这里我们却不能在导入名称空间后使用 Image& ......
关于&、双引号、和单引号的解释
下面先简单地说一下他们的意义。
(1)&是连接运算符,它可以将两个字符串连接成一个字符串。如
a="abc" & "def"
执行连接运算后,a="abcdef ......
#region 1
private void CreateCheckCodeImage()
{
//获取随即字符串
int number;
char code;
string checkCode = String.Empty;
System.Random random1 = new Random();
for (int i = 0; i < 5; i++)
{
number = random1.Next( ......