The best way to understand how Excel can use HTML as a native file format is to perform some simple experiments. Start with a new workbook, and make sure it has only one worksheet. Enter a few values and a formula, do some simple formatting, and then save the workbook in HTML format. Choose the File ^ Save As Web Page command, and make sure you select the Entire Workbook option. Figure 4-1 shows a very simple workbook consisting of two values and a formula, with the formula cell formatted bold. This is a good candidate for learning about the HTML files saved by Excel.
The remainder of the material in this section assumes that you're familiar with HTML.
Next, open the HTML file in your browser. It will, of course, look pretty much like the original workbook. However, it is a "dead" non-interactive document. Choose the browser's View ^ Source command to view the HTML code. You might be surprised by what you see. Even HTML gurus might be overwhelmed by the complexity of this so-called simple Web document.
Following are a few observations about the HTML file:
♦ The entire Excel workbook can usually be represented by a single HTML file. In other words, all the information needed to create an exact replica of the original workbook is contained in the HTML file. This isn't always the case, however. Keep reading to find out when a simple HTML file no longer suffices.
♦ Most of the document is contained within the <head> and </head> tags.
♦ A large portion consists of style definitions. This is the information between the <style> and </style> tags —which is embedded between the <head> and </head> tags.
♦ The actual text that's displayed in the browser is contained in a table (between the <table> and </table> tags).
♦ The formula is preserved by using a proprietary argument for the <td> tag. The proprietary argument is ignored by browsers, but Excel uses this information when the file is reopened.
The HTML file produced for the simple workbook is more than 4,000 bytes in size, which is quite large considering the simplicity of the displayed page. The extra information, of course, is what Excel uses to create a workbook when the HTML file is reopened.
Was this article helpful?