| 12345678910111213141516171819202122232425262728293031323334 |
- <%@ WebHandler Language="C#" Class="excelRW" %>
- using System;
- using System.Web;
- using NPOI.SS.UserModel;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- public class excelRW : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- context.Response.ContentType = "text/html";
- ExcelFile excel = new ExcelFile("template.xls");
- excel.GetWorkbook.GetSheet("封面").GetRow(14).GetCell(6).SetCellValue("东科商标");
- excel.GetWorkbook.GetSheet("内容").GetRow(1).GetCell(15).SetCellValue("东科检验项目");
- excel.GetWorkbook.GetSheet("内容").GetRow(1).GetCell(23).SetCellValue("东科检验结果");
- excel.SaveAs("export.xls");
- context.Response.Write("文件写入成功!<a href='export.xls'>点击下载</a>");
- }
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
|