Class: Axlsx::TableStyle
- Inherits:
-
SimpleTypedList
- Object
- SimpleTypedList
- Axlsx::TableStyle
- Defined in:
- lib/axlsx/stylesheet/table_style.rb
Overview
Note:
Table are not supported in this version and only the defaults required for a valid workbook are created.
A single table style definition and is a collection for tableStyleElements
Instance Attribute Summary collapse
-
#name ⇒ string
The name of this table style.
-
#pivot ⇒ Boolean
indicates if this style should be applied to pivot tables.
-
#table ⇒ Boolean
indicates if this style should be applied to tables.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ TableStyle
constructor
creates a new TableStyle object.
-
#to_xml(xml) ⇒ String
Serializes the table style.
Constructor Details
#initialize(name, options = {}) ⇒ TableStyle
creates a new TableStyle object
23 24 25 26 27 28 29 |
# File 'lib/axlsx/stylesheet/table_style.rb', line 23 def initialize(name, ={}) self.name = name .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? o[0] end super TableStyleElement end |
Instance Attribute Details
#name ⇒ string
The name of this table style
8 9 10 |
# File 'lib/axlsx/stylesheet/table_style.rb', line 8 def name @name end |
#pivot ⇒ Boolean
indicates if this style should be applied to pivot tables
12 13 14 |
# File 'lib/axlsx/stylesheet/table_style.rb', line 12 def pivot @pivot end |
#table ⇒ Boolean
indicates if this style should be applied to tables
16 17 18 |
# File 'lib/axlsx/stylesheet/table_style.rb', line 16 def table @table end |
Instance Method Details
#to_xml(xml) ⇒ String
Serializes the table style
41 42 43 44 45 |
# File 'lib/axlsx/stylesheet/table_style.rb', line 41 def to_xml(xml) attr = self.instance_values.select { |k, v| [:name, :pivot, :table].include? k } attr[:count] = self.size xml.tableStyle(attr) { self.each { |table_style_el| table_style_el.to_xml(xml) } } end |