| ||
You can convert any Excel spreadsheet into an XML document by using File Save As and choosing XML Spreadsheet as the file type. This command will create an XML document that describes both the structure and content of the spreadsheet using SpreadsheetML. Figure 6-24 shows how to create a SpreadsheetML document from Excel.
Excel generates the SpreadsheetML document, which includes a processing instruction:
<?mso-application progid="Excel.Sheet"?>
The processing instruction changes the icon in Windows Explorer and ensures that the document opens in Excel when you double-click the icon. If you want to open an Excel XML document in Flash, youll need to remove the processing instruction first. You can see an example of the icon in Figure 6-25.
In Figure 6-24, youll notice that theres an option to save XML Data in the Save as type drop-down box. You can only use this option where you have an XML map in the spreadsheet. Well look at this option a little later.
Figure 6-26 shows XMLSpy displaying the SpreadsheetML generated by Excel.
You can see that this XML document is very long. It includes markup for the document properties and styles as well as the content. In the example shown in Figure 6-26, Ive generated 172 lines of XML content from a single worksheet with 11 rows and 5 columns . Well explore this further in exercise 3.
In exercise 3, well create a SpreadsheetML document by saving an existing Excel document as an XML spreadsheet.
Open Excel 2003 if necessary.
Choose File Open , and select catalog.xls from your resource files.
Choose File Save As and select the type XML Spreadsheet . Dont change the document name . Click Save . The XML document looks the same as any other spreadsheet when it is open in Excel. You can find the saved document catalog.xml in your resource files.
Close the XML file in Excel and reopen it in an XML or text editor.
Scroll through the file and look at the SpreadsheetML. Notice that some < Cell > elements have a formula attribute as well as the calculated value.
Close the file.