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 ......
在不同版本的 IIS 上使用 ASP.NET MVC
ASP.NET MVC Framework 依赖于 URL 路由。为了利用 URL 路由,可能不得不在 Web 服务器上执行额外的配置步骤。这些步骤取决于 Internet Information Services (IIS) 的版本和应用程序的请求处理模式。
IIS 的最新版本是版本 7.0。IIS 的此版本包括在 Windows Server 2008 中。还可以 ......
在ASP.NET2.0中,为我们提供了两种新功能,方便我们制作共同特征一致的页面和导航。这两种功能是母板页和网站导航。对于母板页大家很清楚了,不过在做母板页时,经常需要添加导航栏,对于此asp.net 2.0 使我们的工作大为简化。这便是站点地图的使用。
顾名思义,站点地图就是在站点 ......
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& ......