Class: Axlsx::TableStyles
- Inherits:
-
SimpleTypedList
- Object
- SimpleTypedList
- Axlsx::TableStyles
- Defined in:
- lib/axlsx/stylesheet/table_styles.rb
Overview
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)
-
- (String) defaultPivotStyle
The default pivot table style.
-
- (String) defaultTableStyle
The default table style.
Attributes inherited from SimpleTypedList
allowed_types, locked_at, serialize_as
Instance Method Summary (collapse)
-
- (TableStyles) initialize(options = {})
constructor
Creates a new TableStyles object that is a container for TableStyle objects.
-
- (String) to_xml(xml)
Serializes the table styles element.
Methods inherited from SimpleTypedList
#<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock
Constructor Details
- (TableStyles) initialize(options = {})
Creates a new TableStyles object that is a container for TableStyle objects
18 19 20 21 22 |
# File 'lib/axlsx/stylesheet/table_styles.rb', line 18 def initialize(={}) @defaultTableStyle = [:defaultTableStyle] || "TableStyleMedium9" @defaultPivotStyle = [:defaultPivotStyle] || "PivotStyleLight16" super TableStyle end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Axlsx::SimpleTypedList
Instance Attribute Details
- (String) defaultPivotStyle
The default pivot table style. The default value is ‘PivotStyleLight6’
13 14 15 |
# File 'lib/axlsx/stylesheet/table_styles.rb', line 13 def defaultPivotStyle @defaultPivotStyle end |
- (String) defaultTableStyle
The default table style. The default value is ‘TableStyleMedium9’
9 10 11 |
# File 'lib/axlsx/stylesheet/table_styles.rb', line 9 def defaultTableStyle @defaultTableStyle end |
Instance Method Details
- (String) to_xml(xml)
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 |