在传递标签名称CSV Excel工作表 [英] Passing in Tab name for CSV excel sheet

查看:125
本文介绍了在传递标签名称CSV Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在与工作表标签有问题要重命名的任何文件名。这样做的问题是,如果用户不小心下载片两次,视窗追加模板(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.

这篇关于在传递标签名称CSV Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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