【发布时间】:2010-09-28 12:51:00
【问题描述】:
如果可能的话,最好是免费的。
我尝试过使用 xml / html 格式,但我遇到了一个问题,即由于内容与 MIME 类型不匹配(工作表是在网络上下载的),excel 会向用户提示安全警告,否似乎可以解决这个问题。
【问题讨论】:
-
您确定使用 Response.AddHeaders 添加了 content-type 和 content-disposition 的标头吗?另请注意,office 2007 及更高版本的 mime 类型(内容类型)与旧版本的 office 不同。
-
是的,我使用了以下内容:
-
Response.AddHeader("Content-Disposition", "Attachment; filename=Report.xls"); Response.ContentType = "application/vnd.ms-excel";
-
说真的,我很惊讶这是一个如此难以解决的问题,而无需花费电子表格设备许可证之类的东西!