import_cond_format
Defined in header: <orcus/spreadsheet/import_interface_cond_format.hpp>
-
class import_cond_format
Interface for importing a single conditional format.
In general, a single conditional format consists of:
one or more cell ranges the format is applied to, and
one or more rules, each of which is one of the five rule types.
start_*method. The following examples show how to import each type of rule.A condition rule that applies a cell format when the cell value is greater than 2:
import_sheet* sheet = ... ; auto* cf = sheet->start_cond_format(); cf->append_range(range); // A2:A13 auto* rule = cf->start_condition(); rule->set_operator(cond_format_operator_t::greater); rule->set_dxf_id(14); // apply differential format (dxf) whose ID is 14 auto* value = rule->start_value(); value->set_formula("2"); value->commit(); rule->commit(); cf->commit();
A date rule that applies a cell format when the cell value falls within the last 7 days:
auto* rule = cf->start_date(); rule->set_period(cond_format_date_t::last_7_days); rule->set_dxf_id(13); rule->commit();
A color scale rule that interpolates between red at the minimum value and green at the maximum value:
auto* rule = cf->start_colorscale(); auto* value = rule->start_value(); value->set_type(cond_format_value_type_t::min); value->set_color(0xFF, 0xFF, 0x00, 0x00); value->commit(); value = rule->start_value(); value->set_type(cond_format_value_type_t::max); value->set_color(0xFF, 0x00, 0xFF, 0x00); value->commit(); rule->commit();
A data bar rule with a blue bar spanning from the minimum value to the maximum value:
auto* rule = cf->start_databar(); rule->set_color_positive(0xFF, 0x63, 0x8E, 0xC6); rule->set_color_negative(0xFF, 0x63, 0x8E, 0xC6); auto* value = rule->start_value(); value->set_type(cond_format_value_type_t::min); value->commit(); value = rule->start_value(); value->set_type(cond_format_value_type_t::max); value->commit(); rule->commit();
An icon set rule with three arrows, switching icons at the 33rd and 67th percentiles:
auto* rule = cf->start_iconset(); rule->set_icon_set(icon_set_t::three_arrows); auto* value = rule->start_value(); value->set_type(cond_format_value_type_t::percent); value->set_formula("0"); value->commit(); value = rule->start_value(); value->set_type(cond_format_value_type_t::percent); value->set_formula("33"); value->commit(); value = rule->start_value(); value->set_type(cond_format_value_type_t::percent); value->set_formula("67"); value->commit(); rule->commit();
Public Functions
-
virtual ~import_cond_format()
-
virtual void append_range(const range_t &range) = 0
Append a cell range the conditional format is applied to.
- Parameters:
range – Cell range the conditional format is applied to.
-
virtual import_cond_format_condition *start_condition() = 0
Start importing a new condition rule.
The implementor should initialize the internal buffer to store the rule data when this method is called.
Note
Note that the import_cond_format implementer must return a non-null pointer.
- Returns:
Interface for importing the new condition rule.
-
virtual import_cond_format_date *start_date() = 0
Start importing a new date rule.
The implementor should initialize the internal buffer to store the rule data when this method is called.
Note
Note that the import_cond_format implementer must return a non-null pointer.
- Returns:
Interface for importing the new date rule.
-
virtual import_cond_format_colorscale *start_colorscale() = 0
Start importing a new color scale rule.
The implementor should initialize the internal buffer to store the rule data when this method is called.
Note
Note that the import_cond_format implementer must return a non-null pointer.
- Returns:
Interface for importing the new color scale rule.
-
virtual import_cond_format_databar *start_databar() = 0
Start importing a new data bar rule.
The implementor should initialize the internal buffer to store the rule data when this method is called.
Note
Note that the import_cond_format implementer must return a non-null pointer.
- Returns:
Interface for importing the new data bar rule.
-
virtual import_cond_format_iconset *start_iconset() = 0
Start importing a new icon set rule.
The implementor should initialize the internal buffer to store the rule data when this method is called.
Note
Note that the import_cond_format implementer must return a non-null pointer.
- Returns:
Interface for importing the new icon set rule.
-
virtual void commit() = 0
Commit the conditional format to the destination store.