zoukankan      html  css  js  c++  java
  • C#中如何防止Excel做科学计算法转换

        C#中如何防止Excel做科学计算法转换

         string style = @"<style>.text{mso-number-format:@;}</style>";//注意这是样式,不需要修改可直接使用


                Response.Clear();
                Response.Buffer = true;


                Response.Charset = "utf-8";
                Response.AppendHeader("Content-Disposition", "attachment;filename=plandetail.xls");
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。 
                System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
                this.GridView2.RenderControl(oHtmlTextWriter);


                Response.Output.Write(style);//这里很重要不写到文件里是无法应用样式的。


                Response.Output.Write(oStringWriter.ToString());
                Response.Flush();
                Response.End();

  • 相关阅读:
    [uboot] (番外篇)uboot relocation介绍(转)
    [uboot] (番外篇)global_data介绍(转)
    [uboot] (第三章)uboot流程——uboot-spl代码流程 后续2018版本分析
    AddressUtils
    ruoyi HttpUtils
    ruoyi IpUtils
    ruoyi StringUtils
    JSONObject
    jackson解析处理JSON
    spring boot pom demo
  • 原文地址:https://www.cnblogs.com/jesn/p/4208317.html
Copyright © 2011-2022 走看看