Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Excel file as html markup

Tags:

html

xml

excel

I have some plain text file (.xls extension) with next markup (attached below). It's opening in excel 2003 without any error.

Now I need to know what is the name of technology, when I could create excel file through html markup?

Becouse I need to fix this file to open correctly in Excel 2007 and earlier. (I see "file in the different format" error now).

<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>
like image 757
Akim Khalilov Avatar asked Oct 14 '22 02:10

Akim Khalilov


1 Answers

The message is new to Excel 2007.

The warning message was added to help prevent issues due to differences between the actual contents of the file and the file extension.

A registry key can be edited to stop the message from displaying.

Under HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security Add a new DWORD Value called ExtensionHardening and set it's value to 0

Alternately a group policy can be set.

See this knowledge base article for more details: "When you open a file in Excel 2007..."


  • Excel 2000 added support for Hypertext Markup Language (HTML) as a native file format - HTML, CSS & XML
  • Excel 2003 added support for Microsoft Office XML formats - SpreadsheetML
  • Excel 2007 added support for Office Open XML

Your example code is based on the Excel 2000 format.

There doesn't seem to be a specific name for the technology.

It is sometimes referred to as Office XML/HTML.

like image 100
Robert Mearns Avatar answered Oct 19 '22 02:10

Robert Mearns