使用数据透视表IE下载Excel文件名[1] [英] Download Excel with pivot table IE appending [1] to file name

查看:130
本文介绍了使用数据透视表IE下载Excel文件名[1]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我面对这个问题。



当我直接从IE中打开保存,IE添加[1] /版本到文件名



示例:后端的Test.xlsx文件,但是当我打开文件被重命名为Test [1] .xlsx.And这是创建的问题。



任何人都可以建议我在这里做错什么。

  // res.setContentType(application / vnd.ms-excel); 
//res.setContentType(\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet);
//res.reset();
//res.setHeader(\"Expires,0);

myDownloadTask {
//res.setHeader(\"Cache-Control\",\"must-revalidate,post-check=0,pre-check = 0);
//res.setHeader(\"Pragma,public);
//res.setContentType(\"application/force-download);
//res.setHeader(\"Content-Transfer-Encoding,binary);
res.setContentType(application / ms-excel; charset = UTF-8);
res.setCharacterEncoding(UTF-8);

fileName = EncodeFileName(fileName);

res.setHeader(Content-Disposition,attachment; filename =+ fileName);
}


解决方案

code> Test.xlsx 已经在您的硬盘上,这就是为什么IE将其重命名为 Test [1] .xlsx 。 p>

我觉得你无法处理,每次都可以在服务器上创建唯一的文件名,或者轻轻地提示用户确保他没有相同的文件他的硬盘上的名字!


Currently I am face this issue.

when I am directly opening from IE with out saving , IE adding [1]/Version to file name

Example: Test.xlsx file in backend but when i am opening the file its renamed to Test[1].xlsx.And this is creating the issue.

Can any one suggest what I am doing wrong here.

//res.setContentType("application/vnd.ms-excel");
               //res.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
               //res.reset();
               //res.setHeader("Expires", "0");

      myDownloadTask{
              //res.setHeader("Cache-Control","must-revalidate,post-check=0, pre-check=0");
               //res.setHeader("Pragma", "public");
               //res.setContentType("application/force-download");
               //res.setHeader("Content-Transfer-Encoding", "binary");
               res.setContentType("application/ms-excel; charset=UTF-8");
               res.setCharacterEncoding("UTF-8");

               fileName=EncodeFileName(fileName);

               res.setHeader("Content-Disposition","attachment; filename="+fileName);
       }

解决方案

You have a file with Test.xlsx already on your hard disk, this is why IE rename it to Test[1].xlsx.

I think you can not handle it, you can create a unique file name on the server every time, or gently prompt to user to make sure he does not have a file with same name on his hard disk !

这篇关于使用数据透视表IE下载Excel文件名[1]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆