Class: ToSpreadsheet::Rule::Format
- Includes:
- TypeFromValue
- Defined in:
- lib/to_spreadsheet/rule/format.rb
Instance Attribute Summary
Attributes inherited from Base
#options, #selector_query, #selector_type
Instance Method Summary collapse
Methods included from TypeFromValue
Methods inherited from Base
#applies_to?, #initialize, #to_s, #type
Methods included from Selectors
#column_number_match?, #css_match, #css_match?, #each_cell, #query_match?, #range_contains?, #range_match, #row_number_match?
Constructor Details
This class inherits a constructor from ToSpreadsheet::Rule::Base
Instance Method Details
#apply(context, sheet) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/to_spreadsheet/rule/format.rb', line 7 def apply(context, sheet) wb = sheet.workbook case selector_type when :css css_match selector_query, context.to_xml_node(sheet) do |xml_node| add_and_apply_style wb, context, context.to_xls_entity(xml_node) end when :row sheet.row_style selector_query, if .present? when :column inline_styles = .except(*COL_INFO_PROPS) sheet.col_style selector_query, inline_styles if inline_styles.present? apply_col_info sheet.column_info[selector_query] when :range add_and_apply_style wb, range_match(selector_query, sheet), context end end |