Sha256: f0743c08dff5c759a63822cd40a8aad3dff9294d60cac2879fa94994cd791c4c

Contents?: true

Size: 1.81 KB

Versions: 48

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for `tableStyleInfo` data
  # https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.tablestyleinfo.aspx
  class TableStyleInfo < OOXMLDocumentObject
    # @return [String] A string representing the name of the table style to use with this table.
    # If the style name does not correspond to the name of a table style then the spreadsheet
    # application should use default style.
    # The possible values for this attribute are defined by the ST_Xstring simple type (22.9.2.19).
    attr_accessor :name

    # @return [True, False] A Boolean indicating whether the first column in the table should have the style applied.
    attr_accessor :show_first_column
    # @return [True, False] A Boolean indicating whether column stripe formatting is applied.
    attr_accessor :show_column_stripes
    # @return [True, False] A Boolean indicating whether the last column in the table should have the style applied.
    attr_accessor :show_last_column
    # @return [True, False] A Boolean indicating whether row stripe formatting is applied.
    attr_accessor :show_row_stripes

    # Parse TableStyleInfo data
    # @param [Nokogiri::XML:Element] node with TableStyleInfo data
    # @return [TableStyleInfo] value of TableStyleInfo data
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'name'
          @name = value.value.to_s
        when 'showColumnStripes'
          @show_column_stripes = attribute_enabled?(value)
        when 'showFirstColumn'
          @show_first_column = attribute_enabled?(value)
        when 'showLastColumn'
          @show_last_column = attribute_enabled?(value)
        when 'showRowStripes'
          @show_row_stripes = attribute_enabled?(value)
        end
      end
      self
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb
ooxml_parser-0.8.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb
ooxml_parser-0.7.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb
ooxml_parser-0.7.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb
ooxml_parser-0.7.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb
ooxml_parser-0.6.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb
ooxml_parser-0.5.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb
ooxml_parser-0.5.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb