【发布时间】:2010-10-13 17:38:51
【问题描述】:
电子表格仍会显示,但会显示警告消息。出现这个问题的原因似乎是 Excel 2007 对匹配其扩展名的格式比早期版本的 Excel 更加挑剔。
该问题最初是由 ASP.Net 程序发现的,并在 Excel 错误中产生“您尝试打开的文件,”Spreadsheet.aspx-18.xls',格式与文件扩展名指定的格式不同.验证...”。但是,当我打开文件时,它显示得很好。我使用的是 Excel 2007。Firefox 将文件识别为 Excel 97-2003 工作表。
这是一个产生问题的 ASP.NET 页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Spreadsheet.aspx.cs" Inherits="Spreadsheet" %>
文件后面的代码如下:
public partial class Spreadsheet : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "application/vnd.ms-excel";
Response.Clear();
Response.Write("Field\tValue\tCount\n");
Response.Write("Coin\tPenny\t443\n");
Response.Write("Coin\tNickel\t99\n");
}
}
T
【问题讨论】: