将Excel文件创建为html标记

时间:2010-07-29 14:27:57

标签: html xml excel

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

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

Becouse我需要修复此文件才能在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>

1 个答案:

答案 0 :(得分:3)

该消息是Excel 2007的新功能。

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

可以编辑注册表项以阻止消息显示。

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

或者,可以设置组策略。

有关详细信息,请参阅此知识库文章:"When you open a file in Excel 2007..."


  • Excel 2000添加了对超文本标记语言(HTML)的支持,作为原生文件格式 - HTML,CSS&amp; XML
  • Excel 2003添加了对Microsoft Office XML格式的支持 - SpreadsheetML
  • Excel 2007添加了对Office Open XML的支持

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

该技术似乎没有具体名称。

有时也称为Office XML / HTML。