2.5.32 CFGradient

The CFGradient structure specifies the parameters of a conditional formatting rule that uses color scale formatting. Color scale formatting maps cell values to colors through the following process:

  1. An interpolation curve maps cell values to values between 0 and 1. The first and last control points, as specified in rgInterp, specify the cell values that map to 0 and 1 respectively.

  2. A gradient curve maps values between 0 and 1 to colors.

Both curves are determined by two or three control points, with linear interpolation between those points.


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

unused

reserved1

cInterpCurve

cGradientCurve

A

B

reserved2

rgInterp (variable)

...

rgCurve (variable)

...

unused (2 bytes): Undefined and MUST be ignored.

reserved1 (1 byte): MUST be zero and MUST be ignored.

cInterpCurve (1 byte): An unsigned integer that specifies the number of control points in the interpolation curve.  It MUST be 0x2 or 0x3.

cGradientCurve (1 byte): An unsigned integer that specifies the number of control points in the gradient curve.  It MUST be equal to cInterpCurve.

A - fClamp (1 bit): A bit that specifies that the cell values are not used when they are out of the range of the interpolation curve. The minimum or the maximum of the interpolation curve is used instead of the cell value. The value SHOULD<155> be 1.

B - fBackground (1 bit): A bit that specifies that the color scale formatting applies to the background of the cells.  It MUST be 1.

reserved2 (6 bits): MUST be zero and MUST be ignored.

rgInterp (variable): An array of CFGradientInterpItem.  Each element is a control point of the interpolation curve. Its element count MUST be cInterpCurve.

rgCurve (variable): An array of CFGradientItem.  Each element is a control point of the gradient curve. Its element count MUST be cGradientCurve.