Excel 电子表格生成导致“文件格式与扩展错误不同"在 excel 2007 中打开时 [英] Excel spreadsheet generation results in "different file format than extension error" when opening in excel 2007

查看:39
本文介绍了Excel 电子表格生成导致“文件格式与扩展错误不同"在 excel 2007 中打开时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

电子表格仍然显示,但带有警告消息.问题似乎是因为 Excel 2007 比早期版本的 Excel 更挑剔与其扩展名匹配的格式.

The spreadsheet still displays, but with the warning message. The problem seems to occur because Excel 2007 is more picky about formats matching their extensions than earlier versions of Excel.

该问题最初是由 ASP.Net 程序发现的,并在 Excel 中产生错误您尝试打开的文件,‘Spreadsheet.aspx-18.xls’,与文件扩展名指定的格式不同.验证...".但是,当我打开文件时,它显示得很好.我使用的是 Excel 2007.Firefox 将该文件识别为 Excel 97-2003 工作表.

The problem was initially discovered by an ASP.Net program and produces in the Excel error "The file you are trying to open, "Spreadsheet.aspx-18.xls', is in a different format than specified by the file extension. Verify ...". However, when I open the file it displays just fine. I am using Excel 2007. Firefox identifies the file as an Excel 97-2003 worksheet.

这是一个产生问题的 ASP.NET 页面:

Here is an ASP.NET page which generates the problem:

<%@ 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	Value	Count
");

        Response.Write("Coin	Penny	443
");
        Response.Write("Coin	Nickel	99
"); 

    } 

}

T

推荐答案

http://blogs.msdn.com/vsofficedeveloper/pages/Excel-2007-Extension-Warning.aspx

这是一个链接,基本上描述了 MS 知道您描述的问题,并且无法从 ASP.NET 代码中抑制它.必须在客户端的注册表中禁止/修复它.

That is a link basically describing that MS knows about the problem your describe and that it cannot be suppressed from within ASP.NET code. It must be suppressed/fixed on the client's registry.

这篇关于Excel 电子表格生成导致“文件格式与扩展错误不同"在 excel 2007 中打开时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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