2.4.224 BrtBeginSortCond

The BrtBeginSortCond record specifies a sort condition and associated row or column (1) to which the sort condition applies, and specifies the beginning of an empty collection of records as defined by the Worksheet part ABNF (section 2.1.7.62), the Macro Sheet (section 2.1.7.32) part ABNF, the Table (section 2.1.7.51) part ABNF, and the Query Table (section 2.1.7.42) part ABNF.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

A

sortOn

unused

rfx (16 bytes)

...

...

...

sortCondUnion

...

...

stSsList (variable)

...

A - fSortDes (1 bit): A bit that specifies the direction of the sort. Possible values for this field are listed in the following table.

Value

Meaning

0

If sortOn is 0x0, sort in ascending order. If sortOn is 0x1 or 0x2, cells in which the cell color/cell font color occurs as specified by sortCondUnion are ordered at the top of the range. If sortOn is 0x3, cells in which the icon occurs as specified by sortCondUnion are ordered at the top of the range.

1

If sortOn is 0x0, sort in descending order. If sortOn is 0x1 or 0x2, cells in which the cell color/cell font color occurs as specified by sortCondUnion are ordered at the bottom of the range. If sortOn is 0x3, cells in which the icon occurs as specified by sortCondUnion are ordered at the bottom of the range.

sortOn (4 bits): An unsigned integer that specifies how the cells in a range are sorted. This value MUST be one of the values listed in the following table.

Value

Meaning

0x0

Sort by the cell value

0x1

Sort by the cell color

0x2

Sort by the cell font color

0x3

Sort by the cell icon

unused (11 bits): This value undefined and MUST be ignored.

rfx (16 bytes): An UncheckedRfX (section 2.5.154) that specifies the row or column (1) to which this sort condition applies. If fCol equals 0 in the BrtBeginSortState (section 2.4.226) that precedes this record as defined in the Worksheet part ABNF, the Macro Sheet part ABNF, the Table (section 2.1.7.51) part ABNF, and the Query Table part ABNF, then this value specifies the column (1) to which this sort condition applies and rfx.colFirst MUST be equal to rfx.colLast. If fCol equals 1 in the BrtBeginSortState that precedes this record as defined in the Worksheet part ABNF, the Macro Sheet part ABNF, the Table part ABNF, and the Query Table part ABNF, then this value specifies the row to which this sort condition applies and rfx.rwFirst MUST be equal to rfx.rwLast. This value MUST be contained within the rfx in the BrtBeginSortState that precedes this record as defined in the Worksheet part ABNF, the Macro Sheet part ABNF, the Table part ABNF, and the Query Table part ABNF.

sortCondUnion (8 bytes): A structure that specifies the conditional data to be evaluated. The data type of this structure depends on the value of the sortOn field, according to the following table.

Value of sortOn

Type and meaning of sortCondUnion

0x0

Unused. This value is undefined and MUST be ignored.

0x1, 0x2

A 4-byte unsigned integer that specifies the zero-based index of a BrtDXF (section 2.4.356) record in the collection of all records directly following BrtBeginDXFs (section 2.4.58). The referenced BrtDXF specifies the differential formatting (section 2.2.6.2) to use for the sort. The latter 4-byte field MUST be 0, and MUST be ignored.

0x3

A CFFlag that specifies the icon and icon set to use for the sort.

stSsList (variable): An XLNullableWideString (section 2.5.167) that specifies a comma-delimited list of strings that specifies a custom sort order (2). The order of strings in the list specifies the sort order (2). When a cell value matches a string in the list, it is sorted ahead of the cell values that match a later string in the list, and so on for each cell in the range. This value MUST be ignored if sortOn is not equal to 0x0.