在传递标签名称CSV Excel工作表名称、标签、工作、CSV

由网友(酒颂)分享简介:我在与工作表标签有问题要重命名的任何文件名。这样做的问题是,如果用户不小心下载片两次,视窗追加模板(1)的.csv将文件保持在其下载目录的独特性。当在Excel中打开,这种纸具有模板(1)的.csv选项卡名称 - 因为它假定文件名I'm having a problem with the Worksheet tab...

我在与工作表标签有问题要重命名的任何文件名。这样做的问题是,如果用户不小心下载片两次,视窗追加模板(1)的.csv将文件保持在其下载目录的独特性。当在Excel中打开,这种纸具有模板(1)的.csv选项卡名称 - 因为它假定文件名

I'm having a problem with the Worksheet tab being renamed to whatever the file name is. The problem with this is if a user accidentally downloads the sheet twice, Windows appends template(1).csv to the file to maintain uniqueness in their download directory. When opened in Excel, this sheet has a tab name of template(1).csv - as it assumes the file name.

//This code correctly downloads a CSV file - but how can I pass in the tab name???
            context.Response.Clear();
            context.Response.ContentType = "text/comma-separated-values";//"application/vnd.ms-excel";
            context.Response.AppendHeader("Content-Disposition", "attachment;filename=template.csv");
            context.Response.Write(csvString);
            context.Response.End();

谢谢!

推荐答案

问题是,CSV文件不包含表,Excel的只是让他们看起来像他们这样做。

The problem is that CSV files do not contain sheets, Excel just makes them look like they do.

无论.csv文件的名称是,Excel将用它来填充工作表名称啄。

Whatever the name of the .csv file is, excel will use that to populate the sheet name thingy.

阅读全文

相关推荐

最新文章