Creating XML Content with Save As

You can convert any Excel spreadsheet into an XML document by using File image from book 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.

image from book
Figure 6-24: Using Save As to generate an XML document

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.

image from book
Figure 6-25: The Excel XML icon

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.

image from book
Figure 6-26: 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.

Exercise 3: Generating XML content with Save As
image from book

In exercise 3, well create a SpreadsheetML document by saving an existing Excel document as an XML spreadsheet.

  1. Open Excel 2003 if necessary.

  2. Choose File image from book Open , and select catalog.xls from your resource files.

  3. Choose File image from book 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.

  4. Close the XML file in Excel and reopen it in an XML or text editor.

  5. Scroll through the file and look at the SpreadsheetML. Notice that some < Cell > elements have a formula attribute as well as the calculated value.

  6. Close the file.

image from book

Foundation XML for Flash
Foundation XML for Flash
ISBN: 1590595432
EAN: 2147483647
Year: 2003
Pages: 93
Authors: Sas Jacobs

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: