Class: Axlsx::TableStyleInfo
- Inherits:
-
Object
- Object
- Axlsx::TableStyleInfo
- Defined in:
- lib/axlsx/workbook/worksheet/table_style_info.rb
Overview
The table style info class manages style attributes for defined tables in a worksheet
Constant Summary collapse
- BOOLEAN_ATTRIBUTES =
boolean attributes for this object
%w(show_first_column show_last_column show_row_stripes show_column_stripes)
Instance Attribute Summary collapse
-
#name ⇒ Object
The name of the table style.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ TableStyleInfo
constructor
creates a new TableStyleInfo instance.
-
#initialize_defaults ⇒ Object
Initialize all the values to false as Excel requires them to explicitly be disabled or all will show.
-
#to_xml_string(str = '') ⇒ Object
seralizes this object to an xml string.
Constructor Details
#initialize(options = {}) ⇒ TableStyleInfo
creates a new TableStyleInfo instance
22 23 24 25 26 27 28 |
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 22 def initialize( = {}) initialize_defaults @name = 'TableStyleMedium9' .each do |k, v| send("#{k}=", v) if respond_to? "#{k}=" end end |
Instance Attribute Details
#name ⇒ Object
The name of the table style.
56 57 58 |
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 56 def name @name end |
Instance Method Details
#initialize_defaults ⇒ Object
Initialize all the values to false as Excel requires them to explicitly be disabled or all will show.
49 50 51 52 53 |
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 49 def initialize_defaults BOOLEAN_ATTRIBUTES.each do |attr| self.send("#{attr}=", 0) end end |
#to_xml_string(str = '') ⇒ Object
seralizes this object to an xml string
60 61 62 63 64 65 66 |
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 60 def to_xml_string(str = '') str << '<tableStyleInfo ' instance_values.each do |key, value| str << Axlsx::camel(key, false) << "='#{value}' " end str << '/>' end |