Class: Axlsx::TableStyle
- Inherits:
-
SimpleTypedList
- Object
- SimpleTypedList
- Axlsx::TableStyle
- Defined in:
- lib/axlsx/stylesheet/table_style.rb
Overview
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)
-
- (string) name
The name of this table style.
-
- (Boolean) pivot
indicates if this style should be applied to pivot tables.
-
- (Boolean) table
indicates if this style should be applied to tables.
Attributes inherited from SimpleTypedList
allowed_types, locked_at, serialize_as
Instance Method Summary (collapse)
-
- (TableStyle) initialize(name, options = {})
constructor
creates a new TableStyle object.
-
- (String) to_xml(xml)
Serializes the table style.
Methods inherited from SimpleTypedList
#<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock
Constructor Details
- (TableStyle) initialize(name, options = {})
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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Axlsx::SimpleTypedList
Instance Attribute Details
- (string) name
The name of this table style
8 9 10 |
# File 'lib/axlsx/stylesheet/table_style.rb', line 8 def name @name end |
- (Boolean) pivot
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 |
- (Boolean) table
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
- (String) to_xml(xml)
Serializes the table style
38 39 40 41 42 |
# File 'lib/axlsx/stylesheet/table_style.rb', line 38 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 |