Excel-Friendly XML SchemasSeveral characteristics make an XML schema more amenable to being mapped into Excel. First, an XML schema should have one root element. In our example in this chapter, the root element is Order. If a schema supports more than one root element, you must choose which element will be the root element when adding the XML map to the spreadsheet. Unsupported XML Schema ConstructsExcel does not support several XML schema constructs. Table 21-1 lists these constructs.
Constructs That Can Be Mapped But Not ExportedThere are also several things that can be mapped but the generated mappings cannot be exported as XML. You have already seen that if an XML mapping is denormalized, it cannot be exported. You also cannot export a list of items containing a second list of items. Choice elements can also not be exported. The other general class of issues that prevents exporting is when a mapped element's relationship with another element it is related to cannot be preserved by the mapping. For more information on these types of mapping issues, consult the Excel documentation. VSTO-Friendly SchemasVSTO puts some additional requirements on schema mapping if you want to use a schema mapped spreadsheet with VSTO. First, you need to have a schema mapping that can be exported. Second, the schema mapping must all be within a single worksheet. Although Excel will let you map some elements of the schema to Sheet1 and other elements to Sheet2, VSTO requires that all schema mapping for a given schema be on the same sheet. How XML Schema Data Types Are Mapped to Excel Cell FormatsAs you saw earlier in this book when mapping dates, Excel can automatically pick cell formatting based on the type in the schema. When we dragged a date into Excel, Excel prompted to change the cell formatting. Table 21-2 shows how Excel maps schema types to Excel cell formatting settings.
![]() |