Class: Axlsx::TableStyleInfo

Inherits:
Object
  • Object
show all
Includes:
Accessors, OptionsParser, SerializedAttributes
Defined in:
lib/axlsx/workbook/worksheet/table_style_info.rb

Overview

The table style info class manages style attributes for defined tables in a worksheet

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedAttributes

included, #serialized_attributes, #serialized_element_attributes, #serialized_tag

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ TableStyleInfo

creates a new TableStyleInfo instance

Parameters:

  • options (Hash) (defaults to: {})
  • [Boolean] (Hash)

    a customizable set of options

  • [String] (Hash)

    a customizable set of options



22
23
24
25
26
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 22

def initialize(options = {})
  initialize_defaults
  @name = 'TableStyleMedium9'
  parse_options options
end

Instance Attribute Details

#nameObject

The name of the table style.



42
43
44
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 42

def name
  @name
end

Instance Method Details

#initialize_defaultsObject

Initialize all the values to false as Excel requires them to explicitly be disabled or all will show.



35
36
37
38
39
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 35

def initialize_defaults
  %w(show_first_column show_last_column show_row_stripes show_column_stripes).each do |attr|
    send(:"#{attr}=", 0)
  end
end

#to_xml_string(str = +'')) ⇒ Object

seralizes this object to an xml string

Parameters:

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

    the string to contact this objects serialization to.



46
47
48
# File 'lib/axlsx/workbook/worksheet/table_style_info.rb', line 46

def to_xml_string(str = +'')
  serialized_tag('tableStyleInfo', str)
end