电子表格仍会显示,但会显示警告消息.问题似乎发生,因为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" %>
Run Code Online (Sandbox Code Playgroud)
文件背后的代码如下:
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");
}
Run Code Online (Sandbox Code Playgroud)
}
Ť