Sha256: 82d96b834998d6b5e08b72f9a64da67baa535b3c668ab7acdfcc4c060ec18da9

Contents?: true

Size: 1.52 KB

Versions: 25

Compression:

Stored size: 1.52 KB

Contents

# encoding: UTF-8
module Axlsx
  # A single table style definition and is a collection for tableStyleElements
  # @note Table are not supported in this version and only the defaults required for a valid workbook are created.
  class TableStyle < SimpleTypedList

    include Axlsx::OptionsParser
    include Axlsx::SerializedAttributes

    # creates a new TableStyle object
    # @raise [ArgumentError] if name option is not provided.
    # @param [String] name
    # @option options [Boolean] pivot
    # @option options [Boolean] table
    def initialize(name, options={})
      self.name = name
      parse_options options
      super TableStyleElement
    end

    serializable_attributes :name, :pivot, :table

    # The name of this table style
    # @return [string]
    attr_reader :name

    # indicates if this style should be applied to pivot tables
    # @return [Boolean]
    attr_reader :pivot

    # indicates if this style should be applied to tables
    # @return [Boolean]
    attr_reader :table

    # @see name
    def name=(v) Axlsx::validate_string v; @name=v end
    # @see pivot
    def pivot=(v) Axlsx::validate_boolean v; @pivot=v end
    # @see table
    def table=(v) Axlsx::validate_boolean v; @table=v end

    # Serializes the object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = '')
      str << '<tableStyle '
      serialized_attributes str, {:count => self.size}
      str << '>'
      each { |table_style_el| table_style_el.to_xml_string(str) }
      str << '</tableStyle>'
    end

  end
end

Version data entries

25 entries across 25 versions & 6 rubygems

Version Path
caxlsx-3.3.0 lib/axlsx/stylesheet/table_style.rb
caxlsx-3.1.1 lib/axlsx/stylesheet/table_style.rb
caxlsx-3.1.0 lib/axlsx/stylesheet/table_style.rb
bonio-axlsx-2.2.3 lib/axlsx/stylesheet/table_style.rb
caxlsx-3.0.4 lib/axlsx/stylesheet/table_style.rb
caxlsx-3.0.3 lib/axlsx/stylesheet/table_style.rb
caxlsx-3.0.2 lib/axlsx/stylesheet/table_style.rb
caxlsx-2.0.2 lib/axlsx/stylesheet/table_style.rb
caxlsx-3.0.1 lib/axlsx/stylesheet/table_style.rb
caxlsx-3.0.0 lib/axlsx/stylesheet/table_style.rb
axlsx-alt-3.0.1 lib/axlsx/stylesheet/table_style.rb
axlsx-alt-3.0.0 lib/axlsx/stylesheet/table_style.rb
axlsx-3.0.0.pre lib/axlsx/stylesheet/table_style.rb
bonio-axlsx-2.2.2 lib/axlsx/stylesheet/table_style.rb
bonio-axlsx-2.2.1 lib/axlsx/stylesheet/table_style.rb
dg-axlsx-2.1.0 lib/axlsx/stylesheet/table_style.rb
axlsx-2.1.0.pre lib/axlsx/stylesheet/table_style.rb
l_axlsx-2.0.1 lib/axlsx/stylesheet/table_style.rb
axlsx-2.0.1 lib/axlsx/stylesheet/table_style.rb
axlsx-2.0.0 lib/axlsx/stylesheet/table_style.rb