Class: Axlsx::TableStyles

Inherits:
SimpleTypedList
  • Object
show all
Includes:
SerializedAttributes
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

Instance Method Summary collapse

Methods included from SerializedAttributes

#declared_attributes, included, #serialized_attributes, #serialized_element_attributes

Constructor Details

#initialize(options = {}) ⇒ TableStyles

Creates a new TableStyles object that is a container for TableStyle objects

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • defaultTableStyle (String)
  • defaultPivotStyle (String)


12
13
14
15
16
# File 'lib/axlsx/stylesheet/table_styles.rb', line 12

def initialize(options={})
  @defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
  @defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"
  super TableStyle
end

Instance Attribute Details

#defaultPivotStyleString

The default pivot table style. The default value is 'PivotStyleLight6'

Returns:

  • (String)


26
27
28
# File 'lib/axlsx/stylesheet/table_styles.rb', line 26

def defaultPivotStyle
  @defaultPivotStyle
end

#defaultTableStyleString

The default table style. The default value is 'TableStyleMedium9'

Returns:

  • (String)


22
23
24
# File 'lib/axlsx/stylesheet/table_styles.rb', line 22

def defaultTableStyle
  @defaultTableStyle
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


36
37
38
39
40
41
42
# File 'lib/axlsx/stylesheet/table_styles.rb', line 36

def to_xml_string(str = '')
  str << '<tableStyles '
  serialized_attributes str, {:count => self.size }
  str << '>'
  each { |table_style| table_style.to_xml_string(str) }
  str << '</tableStyles>'
end