Class: Axlsx::TableStyles
- Inherits:
-
SimpleTypedList
- Object
- SimpleTypedList
- Axlsx::TableStyles
- Defined in:
- lib/axlsx/stylesheet/table_styles.rb
Overview
Note:
Support for custom table styles does not exist in this version. Many of the classes required are defined in preparation for future release. Please do not attempt to add custom table styles.
TableStyles represents a collection of style definitions for table styles and pivot table styles.
Instance Attribute Summary collapse
-
#defaultPivotStyle ⇒ String
The default pivot table style.
-
#defaultTableStyle ⇒ String
The default table style.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ TableStyles
constructor
Creates a new TableStyles object that is a container for TableStyle objects.
-
#to_xml(xml) ⇒ String
Serializes the table styles element.
Constructor Details
#initialize(options = {}) ⇒ TableStyles
Creates a new TableStyles object that is a container for TableStyle objects
17 18 19 20 21 |
# File 'lib/axlsx/stylesheet/table_styles.rb', line 17 def initialize(={}) @defaultTableStyle = [:defaultTableStyle] || "TableStyleMedium9" @defaultPivotStyle = [:defaultPivotStyle] || "PivotStyleLight16" super TableStyle end |
Instance Attribute Details
#defaultPivotStyle ⇒ String
The default pivot table style. The default value is ‘PivotStyleLight6’
12 13 14 |
# File 'lib/axlsx/stylesheet/table_styles.rb', line 12 def defaultPivotStyle @defaultPivotStyle end |
#defaultTableStyle ⇒ String
The default table style. The default value is ‘TableStyleMedium9’
8 9 10 |
# File 'lib/axlsx/stylesheet/table_styles.rb', line 8 def defaultTableStyle @defaultTableStyle end |
Instance Method Details
#to_xml(xml) ⇒ String
Serializes the table styles element
30 31 32 33 34 35 36 |
# File 'lib/axlsx/stylesheet/table_styles.rb', line 30 def to_xml(xml) attr = self.instance_values.reject {|k, v| ![:defaultTableStyle, :defaultPivotStyle].include?(k.to_sym) } attr[:count] = self.size xml.tableStyles(attr) { self.each { |table_style| table_style.to_xml(xml) } } end |