zoukankan      html  css  js  c++  java
  • .net 导出Excel

    1、引用Interop.MSXML2 DLL , 2、录入XSL文件,注意Worksheet格式 請款單號
    后台代码: XmlDocument myXml = new XmlDataDocument(ds); MSXML2.DOMDocument pXmlDocShow = new DOMDocumentClass(); pXmlDocShow.async = false; pXmlDocShow.loadXML(myXml.InnerXml); XmlDocument pXslDoc = new XmlDocument(); if (formType.Trim() == "CARR.FORM.2") { pXslDoc.Load(Server.MapPath("QueryFormsOfFeePC.xsl")); } else { pXslDoc.Load(Server.MapPath("QueryFormsOfFeeEP.xsl")); } MSXML2.DOMDocument pXslDocShow = new DOMDocumentClass(); pXslDocShow.async = false; pXslDocShow.loadXML(pXslDoc.InnerXml); string strTemp = pXmlDocShow.transformNode(pXslDocShow); int strTempBegin = strTemp.IndexOf(""); strTemp = strTemp.Remove(strTempBegin, strTempEnd - strTempBegin + 2); strTemp = @"" + strTemp; string _fileXls = DateTime.Now.ToString("yyyyMMdd"); Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.AddHeader("Content-Disposition", "attachment; filename=" + _fileXls + ".xls"); Response.ContentType = "application/ms-word"; Response.Write(strTemp); Response.End();
  • 相关阅读:
    Windows 系统变量大全
    linux编程
    CSS 对齐操作
    php 和 表单 简单交互
    HTML <input> placeholder 属性
    HTML <label> 标签
    Chap-4 Section 4.4 C++相关问题
    Chap-4 Section 4.3 COMMON块
    Chap-4 Section 4.2.4 指令修正方式
    Chap-4 Section 4.2.3 符号解析
  • 原文地址:https://www.cnblogs.com/Chinarain/p/4276428.html
Copyright © 2011-2022 走看看