using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; namespace FangYar.WebUI.ashx { /// /// ExportHandler 的摘要说明 /// public class ZYExportHandler : IHttpHandler { private FangYar.BLL.CommomBLL bll = new BLL.CommomBLL(); public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string action = context.Request.Params["Action"]; string returnstr = ""; switch (action) { case "ExpDevice": ExpDevice(context); break; } context.Response.Write(returnstr); } //查询 private void ExpDevice(HttpContext context) { DataTable list = bll.GetTableList("*", "tbl_sys_dicdetail", " MOD_CODE ='HYTYPE'"); Dictionary cellHeaders = new Dictionary(); cellHeaders.Add("ID", "主键"); cellHeaders.Add("MOD_CODE", "模块"); cellHeaders.Add("DIC_TEXT", "名称"); cellHeaders.Add("DIC_VALUE", "值"); cellHeaders.Add("DIC_FID", "父值"); cellHeaders.Add("DIC_ORDER", "排序"); FangYar.Common.NPOIWordHelper.ExportByWeb(list, "字典项", cellHeaders, "字典项"); } public bool IsReusable { get { return false; } } } }