Export (0) Print
Expand All

3.2.2.1 Sortmap Elements

This subclause specifies the elements and simple types that comprise the Sort Map.

A sort map is used in the context of a shared workbook to record the sort order of a range of cells. This information is used to correctly update cells and formulas that depend on the sort order when revision information is applied. There is one sort map per worksheet.

The sort map consists of two components: The row sort map and the column sort map. The row sort map contains a list of row indices that need to be adjusted when revision information is applied. The row sort map is created when a range of cells is sorted top down or bottom up. The column sort map contains a list of column indices that need to be adjusted when revision information is applied. The column sort map is created when a range of cells is sorted left to right or right to left.

[Example: Consider the following shared workbook:

Ff535159.73ece90d-0937-46cd-a902-76d3f62a4082(en-us,office.12).jpg

The worksheet contains four rows of data. Once the data is sorted in descending order, the worksheet looks as follows:

Ff535159.c46923ed-ea5c-41ac-a61e-ed72df62a465(en-us,office.12).jpg

When this worksheet is saved, the following sort map should be created and saved to the file:

<worksheetSortMap xmlns="http://schemas.microsoft.com/office/excel/2006/main">
   <rowSortMap ref="A2:XFD5" count="4">
      <row newVal="1" oldVal="4"/>
      <row newVal="2" oldVal="3"/>
      <row newVal="3" oldVal="2"/>
      <row newVal="4" oldVal="1"/>
   </rowSortMap>
</worksheetSortMap>

In the context of this example, the sort map implies that the contents of the second row should be replaced with the contents of the fifth row; contents of the third row should be replaced with the contents of the fourth row; and so on.

Now consider the following worksheet:

Ff535159.be5f7184-aee2-4da0-8a14-b7ae2bef3e60(en-us,office.12).jpg

This worksheet contains four columns of data. Once the data is sorted left to right in descending order, the worksheet looks as follows:

Ff535159.ee8b1fbf-8cda-44b2-8ddf-afe5950e67fd(en-us,office.12).jpg

When this worksheet is saved, the following sort map should be created and saved to the file:

<worksheetSortMap xmlns="http://schemas.microsoft.com/office/excel/2006/main">
   <colSortMap ref="A1:D1048576" count="4">
      <col newVal="0" oldVal="3"/>
      <col newVal="1" oldVal="2"/>
      <col newVal="2" oldVal="1"/>
      <col newVal="3" oldVal="0"/>
   </colSortMap>
</worksheetSortMap>

In the context of this example, the sort map implies that the contents of the first column should be replaced with the contents of the fourth column; contents of the second column should be replaced with the contents of the third column; and so on.

End Example]

Show:
© 2015 Microsoft