Microsoft Office Tutorials and References
In Depth Information
Figure 26-7. The AssignElementsToRanges procedure maps schema elements to cell ranges
on your worksheet, creating lists.
The AssignElementsToRanges procedure creates a list for each element in the MySuppliers.xsd
schema, but creating individual lists poses a problem: when you type a new data element into
a list (for example, the SupplierID list) and press Tab, you’re taken to a new row in the same
list, not to what is logically the next cell in the list. You can tell that the procedure created a
series of lists, not a single list, by the presence of blue lines on the borders of the columns. If
you were to map the same schema to your worksheet by dragging the Supplier element from
the XML Source task pane to cell B2, you would create a single list. The good news, however,
is that if you filter a list by clicking the down arrow at the right edge of a column heading and
selecting a filter criteria, you still filter all the lists. But how do you create a list that lets you
tab from one column to another?
Mapping a Schema to a Single List
When you create a multi-column list, you create a seamless object into which you can type
data. But creating a series of lists, as in this chapter’s AssignElementsToRanges procedure,
doesn’t let you use the Tab key to move from one column to the next in the collection of
lists. So how do you map a series of schema elements in such a way that you get full
list functionality? By creating a list on your worksheet and mapping the schema elements
to the list’s column headers. The following procedure creates just such a list for the
MySuppliers.xsd and MySuppliers.xml files, with the results shown in Figure 26-8.