设置 Excel 电子表格工作表标题

发布于 2024-12-15 05:29:53 字数 371 浏览 2 评论 0原文

使用经典 Asp 文件生成 Excel .xls 文件。我想知道是否有办法设置工作表标题,因为目前仅使用文件名,所以如果文件名是 Ad_Results.xls 那么工作表将是 Ad_Results 1?

这是我最初用来创建文件的代码:

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=Shoom_Ad_Results.xls" 
Response.CharSet = "iso-8859-1"

我在谷歌上查看过,但没有明确的版本,也没有说明实际上是否可以完成。谢谢。

Working with Classic Asp file which generates an Excel .xls file. I am wondering if there is a way to set the worksheet title, as currently is just uses the file name, so if the filename is Ad_Results.xls then the worksheet will be Ad_Results 1?

This is the code that I am using to create the file initially:

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=Shoom_Ad_Results.xls" 
Response.CharSet = "iso-8859-1"

I've looked on google but there is no definitive version, nor is it stated if in fact it can be done. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尤怨 2024-12-22 05:29:53

我不了解经典 ASP,但我只是在 ASP.NET 中做到了这一点。也许你会发现它很有用。

Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
Response.Write("<head>");
Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=windows-1252\">");
Response.Write("<!--[if gte mso 9]>");
Response.Write("<xml>");
Response.Write("<x:ExcelWorkbook>");
Response.Write("<x:ExcelWorksheets>");
Response.Write("<x:ExcelWorksheet>");
Response.Write("<x:Name>Sheet1</x:Name>");
Response.Write("</x:ExcelWorksheet>");
Response.Write("</x:ExcelWorksheets>");
Response.Write("</x:ExcelWorkbook>");
Response.Write("</xml>");
Response.Write("<![endif]-->");
Response.Write("</head>");

I don't know about Classic ASP but I just did this in ASP.NET. Maybe you can find it useful.

Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
Response.Write("<head>");
Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=windows-1252\">");
Response.Write("<!--[if gte mso 9]>");
Response.Write("<xml>");
Response.Write("<x:ExcelWorkbook>");
Response.Write("<x:ExcelWorksheets>");
Response.Write("<x:ExcelWorksheet>");
Response.Write("<x:Name>Sheet1</x:Name>");
Response.Write("</x:ExcelWorksheet>");
Response.Write("</x:ExcelWorksheets>");
Response.Write("</x:ExcelWorkbook>");
Response.Write("</xml>");
Response.Write("<![endif]-->");
Response.Write("</head>");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文