惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

博客园 - Michael.li

excel中使用sum函数计算包含小数列,结果出现多位小数值 使用 SqlBulkCopy 向 destinationTableName 表插入数据 使用Wireshark抓包QQ聊天用户IP地址 MSSQL数据库设计心得 Html5大文件断点续传 c# 使用protobuf格式操作 Redis Web网站架构设计 extjs中的tabpanle下的combobox提交问题 Asp.net下from认证统一认证配置 Extjs 4.07 对类型定义引发的匹配问题 Supesoft权限管理系统(FrameWork) 1.0.9 Release 手机6120C 玩仙剑dos版 ASP.NET权限管理系统(FrameWork) 1.0.8 Release ASP.NET权限管理系统(FrameWork) 1.0.7 Release 广告统计分析系统(ADCount) 1.0.0 Beta DDBuildTools 1.3.0 Release发布 ASP.NET权限管理系统(FrameWork) 1.0.6 Release remoting缓存设计总结 - Michael.li - 博客园 ASP.NET权限管理系统(FrameWork) 1.0.5 Release
关于在Page_Load定义外部变量输出 - Michael.li - 博客园
Michael.li · 2008-12-27 · via 博客园 - Michael.li

string cmd = (string)Common.sink("cmd", MethodType.Get, 255, 0, DataType.Str);      

  protected void Page_Load(object sender, EventArgs e)
        {

            if (cmd == "DownLoad")
            {
                DownXslFile();
            }

        }

/// <summary>
        /// 导出Excel文档
        /// </summary>
        protected void DownXslFile()
        {


            System.IO.StringWriter sw = new System.IO.StringWriter();

            Server.Execute("report.aspx?cmd=ssss", sw, false);
            string abcd = sw.ToString();
            string fileName = "考勤报表_" + DateTime.Now.Date.ToString("yyyyMMdd") + ".xls";

            //Response.Headers.Clear();
            Response.Clear();
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName));
            Response.Charset = "utf-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "application/ms-excel";
            Response.Write(abcd.ToString());
            Response.End();
        }

 发现生成的文件内容为空.

后来将string cmd = (string)Common.sink("cmd", MethodType.Get, 255, 0, DataType.Str);      放入page_load方法中才成功.

如下:

  protected void Page_Load(object sender, EventArgs e)
        {

          string cmd = (string)Common.sink("cmd", MethodType.Get, 255, 0, DataType.Str);      

            if (cmd == "DownLoad")
            {
                DownXslFile();
            }

        }