Module: Writexlsx::Worksheet::ConditionalFormats
- Included in:
- Writexlsx::Worksheet
- Defined in:
- lib/write_xlsx/worksheet/conditional_formats.rb
Overview
Conditional formatting operations extracted from Worksheet to slim the main class.
Instance Method Summary collapse
-
#conditional_formatting(*args) ⇒ Object
:call-seq: conditional_formatting(cell_or_cell_range, options).
-
#write_conditional_formatting(range, cond_formats) ⇒ Object
Write the <conditionalFormatting> element.
Instance Method Details
#conditional_formatting(*args) ⇒ Object
:call-seq:
conditional_formatting(cell_or_cell_range, )
Conditional formatting is a feature of Excel which allows you to apply a format to a cell or a range of cells based on a certain criteria.
14 15 16 17 18 |
# File 'lib/write_xlsx/worksheet/conditional_formats.rb', line 14 def conditional_formatting(*args) cond_format = Package::ConditionalFormat.factory(self, *args) @cond_formats[cond_format.range] ||= [] @cond_formats[cond_format.range] << cond_format end |
#write_conditional_formatting(range, cond_formats) ⇒ Object
Write the <conditionalFormatting> element.
23 24 25 26 27 |
# File 'lib/write_xlsx/worksheet/conditional_formats.rb', line 23 def write_conditional_formatting(range, cond_formats) # :nodoc: @writer.tag_elements('conditionalFormatting', [['sqref', range]]) do cond_formats.each(&:write_cf_rule) end end |