我有一些带有下一个标记的纯文本文件(.xls 扩展名)(附在下面)。它在 excel 2003 中打开,没有任何错误。
现在我需要知道什么是技术名称,什么时候可以通过html标记创建excel文件?
因为我需要修复此文件才能在 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>
Run Code Online (Sandbox Code Playgroud)
该消息是 Excel 2007 中的新消息。
添加警告消息是为了帮助防止由于文件的实际内容与文件扩展名之间的差异而导致的问题。
可以编辑注册表项以停止显示消息。
在添加一个名为ExtensionHardeningHKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security的
新DWORD 值并将其值设置为0
或者可以设置组策略。
有关更多详细信息,请参阅此知识库文章:“当您在 Excel 2007 中打开文件时...”
您的示例代码基于 Excel 2000 格式。
该技术似乎没有具体的名称。
它有时称为 Office XML/HTML。