创buildExcel文件作为html标记

我有一些纯文本文件(.xls扩展名)与下一个标记(下面附加)。 它在Excel 2003中打开,没有任何错误。

现在我需要知道什么是技术的名称,当我可以通过HTML标记创buildExcel文件?

以前我需要修复这个文件在Excel 2007及更早版本中正确打开。 (我现在看到“格式不同的文件”错误)。

<html xmlns:o=\"urn:schemas-microsoft-com:office:office\\ xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=utf-8"> <meta name=ProgId content=Excel.Sheet> <meta name=Generator content="Microsoft Excel"> <!--[if gte mso 9]><xml> <x:ExcelWorkbook> <x:ExcelWorksheets> <x:ExcelWorksheet> <x:Name>Sheet1</x:Name> <x:WorksheetOptions> <x:Selected/> <x:ProtectContents>False</x:ProtectContents> <x:ProtectObjects>False</x:ProtectObjects> <x:ProtectScenarios>False</x:ProtectScenarios> </x:WorksheetOptions> </x:ExcelWorksheet> </x:ExcelWorksheets> <x:ProtectStructure>False</x:ProtectStructure> <x:ProtectWindows>False</x:ProtectWindows> </x:ExcelWorkbook> </xml><![endif]--> <style> <!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:" ";} .xl2 { mso-number-format:M/D/YY; border-left:.5pt solid; border-top:.5pt solid; border-right:.5pt solid; border-bottom:.5pt solid; } .xl3 { border-left:.5pt solid; border-top:.5pt solid; border-right:.5pt solid; border-bottom:.5pt solid; } --> </style> </head> <body> <table> <tr> <td class=xl2>17.02.2010</td> <td class=xl3>4</td> <td class=xl3>0</td> </tr> <tr> </tr> </table> </body> </html> 

该消息是Excel 2007的新增function。

添加了警告消息,以帮助防止由于文件的实际内容和文件扩展名之间的差异而导致的问题。

可以编辑registry项来停止显示消息。

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security添加一个名为ExtensionHardening的新DWORD值 ,并将其值设置为0

或者可以设置组策略。

有关更多详细信息,请参阅此知识库文章: “当您在Excel 2007中打开文件…”


  • Excel 2000增加了对超文本标记语言(HTML)的支持,将其作为本地文件格式 – HTML,CSS和XML
  • Excel 2003添加了对Microsoft Office XML格式的支持 – SpreadsheetML
  • Excel 2007增加了对Office Open XML的支持

您的示例代码基于Excel 2000格式。

似乎没有这个技术的具体名称。

它有时被称为Office XML / HTML。