ASP.NET中Excel操作类C#版
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Office.Interop;
using Microsoft.Office.Core;
namespace ExcelEdit
{
/// <summary >
/// ExcelEdit 的摘要说明
/// </summary >
public class ExcelEdit
{
public string mFilename;
public Excel.Application app;
public Excel.Workbooks wbs;
public Excel.Workbook wb;
public Excel.Worksheets wss;
public Excel.Worksheet ws;
public ExcelEdit()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void Create()//创建一个Excel对象
{
app = new Excel.Application();
wbs = app.Workbooks;
wb = wbs.Add(true);
}
public void Open(string FileName)//打开一个Excel文件
{
app = new Excel.Application();
wbs = app.Workbooks;
wb = wbs.Add(FileName);
//wb = wbs.Open(FileName, 0, true, 5, " ", " ", true, Excel.XlPlatform.xlWindows, "\t ", false, false, 0, true,Type.Missing,Type.Missing);
//wb = wbs.Open(FileName,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Excel.XlPlatform.xlWindows,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
mFilename = FileName;
}
public Excel.Worksheet GetSheet(string SheetName)//获取一个工作表
{
Excel.Worksheet s = (Excel.Worksheet)wb.Worksheets[SheetName];
return s;
}
相关文档:
http://www.cnblogs.com/chsword/archive/2008/03/10/dotnetmvcframework.html
以下文章属于ASP.NET MVC 1.0 正式版
ASP.NET MVC雕虫小技 1-2
ASP.NET MVC 重点教程一周年版 第十一回 母版页、用户自定义控件及文件上传
ASP.NET MVC 重点教程一周年版 第十回 请求Controller
ASP.NET MVC 重点教程一周年版 第九回 H ......
Parameter Queries in ASP.NET with MS Access
A selection of code samples for executing queries against MS Access using parameters.
Making use of the ASP.NET 2.0 datasource controls is fine, but it is important to understand how to manually create data access code. Best practice dictates that, at t ......
Paging long articles in ASP.NET using C#
Long articles are better broken into bite-sized chunks over several pages. With static HTML, this is easily achieved by dividing the article into logical separations and creating separate .htm files for each. Here's how to do it using C# for an article that ......
在后台用C#枚举控件不像javascript那么简单,HasControls只能抓到直属下级的控件,如果有多个div,table嵌套,就要递归了
public static void CloseAllContent(System.Web.UI.Control page,bool bOpen)
{
int nPageControls = page.Controls.Count ......
Windows 身份验证提供程序 提供有关如何将 Windows 身份验证与 Microsoft Internet 信息服务 (IIS) 身份验证结合使用来确保 ASP.NET 应用程序安全的信息。 Forms 身份验证提供程序 提供有关如何使用您自己的代码创建应用程序特定的登录窗体并执行身份验证的信息。使用 Forms 身份验证的一种简便方法是使用 ASP.NET 成员资格 ......