libxlsxwriter
Loading...
Searching...
No Matches
Data Fields
lxw_conditional_format Struct Reference

Worksheet conditional formatting options. More...

Detailed Description

The fields/options in the the lxw_conditional_format are used to define a worksheet conditional format. It is used in conjunction with worksheet_conditional_format().

Examples
conditional_format1.c, and conditional_format2.c.

Data Fields

uint8_t type
 
uint8_t criteria
 
double value
 
const char * value_string
 
lxw_formatformat
 
double min_value
 
const char * min_value_string
 
uint8_t min_rule_type
 
lxw_color_t min_color
 
double mid_value
 
const char * mid_value_string
 
uint8_t mid_rule_type
 
lxw_color_t mid_color
 
double max_value
 
const char * max_value_string
 
uint8_t max_rule_type
 
lxw_color_t max_color
 
lxw_color_t bar_color
 
uint8_t bar_only
 
uint8_t data_bar_2010
 
uint8_t bar_solid
 
lxw_color_t bar_negative_color
 
lxw_color_t bar_border_color
 
lxw_color_t bar_negative_border_color
 
uint8_t bar_negative_color_same
 
uint8_t bar_negative_border_color_same
 
uint8_t bar_no_border
 
uint8_t bar_direction
 
uint8_t bar_axis_position
 
lxw_color_t bar_axis_color
 
uint8_t icon_style
 
uint8_t reverse_icons
 
uint8_t icons_only
 
const char * multi_range
 
uint8_t stop_if_true
 

Field Documentation

◆ type

uint8_t lxw_conditional_format::type

The type of conditional format such as LXW_CONDITIONAL_TYPE_CELL or LXW_CONDITIONAL_DATA_BAR. Should be a lxw_conditional_format_types value.

Examples
conditional_format1.c, and conditional_format2.c.

◆ criteria

uint8_t lxw_conditional_format::criteria

The criteria parameter is used to set the criteria by which the cell data will be evaluated. For example in the expression a > 5 the criteria is>` or, in libxlsxwriter terms, LXW_CONDITIONAL_CRITERIA_GREATER_THAN. The criteria that are applicable depend on the conditional format type. The criteria options are defined in lxw_conditional_criteria.

Examples
conditional_format1.c, and conditional_format2.c.

◆ value

double lxw_conditional_format::value

The number value to which the condition refers. For example in the expression a > 5, the value is 5.

Examples
conditional_format1.c, and conditional_format2.c.

◆ value_string

const char* lxw_conditional_format::value_string

The string value to which the condition refers, such as "=A1". If a value_string exists in the struct then the number value is ignored. Note, if the condition refers to a text string then it must be double quoted like this "foo".

◆ format

lxw_format* lxw_conditional_format::format

The format field is used to specify the lxw_format format that will be applied to the cell when the conditional formatting criterion is met. The lxw_format is created using the workbook_add_format() method in the same way as cell formats.

Note
In Excel, a conditional format is superimposed over the existing cell format and not all cell format properties can be modified. Properties that cannot be modified, in Excel, by a conditional format are: font name, font size, superscript and subscript, diagonal borders, all alignment properties and all protection properties.
Examples
conditional_format1.c, and conditional_format2.c.

◆ min_value

double lxw_conditional_format::min_value

The minimum value used for Cell, Color Scale and Data Bar conditional formats. For Cell types this is usually used with a "Between" style criteria.

Examples
conditional_format2.c.

◆ min_value_string

const char* lxw_conditional_format::min_value_string

The minimum string value used for Cell, Color Scale and Data Bar conditional formats. Usually used to set ranges like =A1.

◆ min_rule_type

uint8_t lxw_conditional_format::min_rule_type

The rule used for the minimum condition in Color Scale and Data Bar conditional formats. The rule types are defined in lxw_conditional_format_rule_types.

◆ min_color

lxw_color_t lxw_conditional_format::min_color

The color used for the minimum Color Scale conditional format. See Working with Colors.

Examples
conditional_format2.c.

◆ mid_value

double lxw_conditional_format::mid_value

The middle value used for Color Scale and Data Bar conditional formats.

◆ mid_value_string

const char* lxw_conditional_format::mid_value_string

The middle string value used for Color Scale and Data Bar conditional formats. Usually used to set ranges like =A1.

◆ mid_rule_type

uint8_t lxw_conditional_format::mid_rule_type

The rule used for the middle condition in Color Scale and Data Bar conditional formats. The rule types are defined in lxw_conditional_format_rule_types.

◆ mid_color

lxw_color_t lxw_conditional_format::mid_color

The color used for the middle Color Scale conditional format. See Working with Colors.

Examples
conditional_format2.c.

◆ max_value

double lxw_conditional_format::max_value

The maximum value used for Cell, Color Scale and Data Bar conditional formats. For Cell types this is usually used with a "Between" style criteria.

Examples
conditional_format2.c.

◆ max_value_string

const char* lxw_conditional_format::max_value_string

The maximum string value used for Cell, Color Scale and Data Bar conditional formats. Usually used to set ranges like =A1.

◆ max_rule_type

uint8_t lxw_conditional_format::max_rule_type

The rule used for the maximum condition in Color Scale and Data Bar conditional formats. The rule types are defined in lxw_conditional_format_rule_types.

◆ max_color

lxw_color_t lxw_conditional_format::max_color

The color used for the maximum Color Scale conditional format. See Working with Colors.

Examples
conditional_format2.c.

◆ bar_color

lxw_color_t lxw_conditional_format::bar_color

The bar_color field sets the fill color for data bars. See Working with Colors.

Examples
conditional_format2.c.

◆ bar_only

uint8_t lxw_conditional_format::bar_only

The bar_only field sets The bar_only field displays a bar data but not the data in the cells.

Examples
conditional_format2.c.

◆ data_bar_2010

uint8_t lxw_conditional_format::data_bar_2010

In Excel 2010 additional data bar properties were added such as solid (non-gradient) bars and control over how negative values are displayed. These properties can shown below.

The data_bar_2010 field sets Excel 2010 style data bars even when Excel 2010 specific properties aren't used.

Examples
conditional_format2.c.

◆ bar_solid

uint8_t lxw_conditional_format::bar_solid

The bar_solid field turns on a solid (non-gradient) fill for data bars. Set to LXW_TRUE to turn on. Excel 2010 only.

Examples
conditional_format2.c.

◆ bar_negative_color

lxw_color_t lxw_conditional_format::bar_negative_color

The bar_negative_color field sets the color fill for the negative portion of a data bar. See Working with Colors. Excel 2010 only.

◆ bar_border_color

lxw_color_t lxw_conditional_format::bar_border_color

The bar_border_color field sets the color for the border line of a data bar. See Working with Colors. Excel 2010 only.

◆ bar_negative_border_color

lxw_color_t lxw_conditional_format::bar_negative_border_color

The bar_negative_border_color field sets the color for the border of the negative portion of a data bar. See Working with Colors. Excel 2010 only.

◆ bar_negative_color_same

uint8_t lxw_conditional_format::bar_negative_color_same

The bar_negative_color_same field sets the fill color for the negative portion of a data bar to be the same as the fill color for the positive portion of the data bar. Set to LXW_TRUE to turn on. Excel 2010 only.

Examples
conditional_format2.c.

◆ bar_negative_border_color_same

uint8_t lxw_conditional_format::bar_negative_border_color_same

The bar_negative_border_color_same field sets the border color for the negative portion of a data bar to be the same as the border color for the positive portion of the data bar. Set to LXW_TRUE to turn on. Excel 2010 only.

Examples
conditional_format2.c.

◆ bar_no_border

uint8_t lxw_conditional_format::bar_no_border

The bar_no_border field turns off the border for data bars. Set to LXW_TRUE to enable. Excel 2010 only.

◆ bar_direction

uint8_t lxw_conditional_format::bar_direction

The bar_direction field sets the direction for data bars. This property can be either left for left-to-right or right for right-to-left. If the property isn't set then Excel will adjust the position automatically based on the context. Should be a lxw_conditional_format_bar_direction value. Excel 2010 only.

Examples
conditional_format2.c.

◆ bar_axis_position

uint8_t lxw_conditional_format::bar_axis_position

The bar_axis_position field sets the position within the cells for the axis that is shown in data bars when there are negative values to display. The property can be either middle or none. If the property isn't set then Excel will position the axis based on the range of positive and negative values. Should be a lxw_conditional_bar_axis_position value. Excel 2010 only.

◆ bar_axis_color

lxw_color_t lxw_conditional_format::bar_axis_color

The bar_axis_color field sets the color for the axis that is shown in data bars when there are negative values to display. See Working with Colors. Excel 2010 only.

◆ icon_style

uint8_t lxw_conditional_format::icon_style

The Icons Sets style is specified by the icon_style parameter. Should be a lxw_conditional_icon_types.

Examples
conditional_format2.c.

◆ reverse_icons

uint8_t lxw_conditional_format::reverse_icons

The order of Icon Sets icons can be reversed by setting reverse_icons to LXW_TRUE.

Examples
conditional_format2.c.

◆ icons_only

uint8_t lxw_conditional_format::icons_only

The icons can be displayed without the cell value by settings the icons_only parameter to LXW_TRUE.

Examples
conditional_format2.c.

◆ multi_range

const char* lxw_conditional_format::multi_range

The multi_range field is used to extend a conditional format over non-contiguous ranges.

It is possible to apply the conditional format to different cell ranges in a worksheet using multiple calls to worksheet_conditional_format(). However, as a minor optimization it is also possible in Excel to apply the same conditional format to different non-contiguous cell ranges.

This is replicated in worksheet_conditional_format() using the multi_range option. The range must contain the primary range for the conditional format and any others separated by spaces. For example "A1 C1:C5 E2 G1:G100".

Examples
conditional_format2.c.

◆ stop_if_true

uint8_t lxw_conditional_format::stop_if_true

The stop_if_true parameter can be used to set the "stop if true" feature of a conditional formatting rule when more than one rule is applied to a cell or a range of cells. When this parameter is set then subsequent rules are not evaluated if the current rule is true. Set to LXW_TRUE to turn on.