Sha256: 6f95bc241a3018bf9594e127ff254c4d2767cc5c56e6bba9e0dc00badd987c51

Contents?: true

Size: 1.87 KB

Versions: 40

Compression:

Stored size: 1.87 KB

Contents

# frozen_string_literal: true

require_relative 'table_style_properties/table_style_properties_helper'
module OoxmlParser
  # Class for parsing `w:tblStylePr`
  class TableStyleProperties < OOXMLDocumentObject
    # @return [Symbol] type of Table Style Properties
    attr_accessor :type
    # @return [RunProperties] properties of run
    attr_accessor :run_properties
    # @return [CellProperties] properties of table cell
    attr_accessor :table_cell_properties
    # @return [TableProperties] properties of table
    attr_accessor :table_properties
    # @return [TableRowProperties] properties of table row
    attr_reader :table_row_properties
    # @return [ParagraphProperties] properties of paragraph
    attr_accessor :paragraph_properties

    alias cell_properties table_cell_properties

    def initialize(type: nil, parent: nil)
      @type = type
      @run_properties = nil
      @table_cell_properties = CellProperties.new
      super(parent: parent)
    end

    # Parse table style property
    # @param node [Nokogiri::XML::Element] node to parse
    # @return [TableStyleProperties]
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'type'
          @type = value.value.to_sym
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'rPr'
          @run_properties = RunProperties.new(parent: self).parse(node_child)
        when 'tcPr'
          @table_cell_properties = CellProperties.new(parent: self).parse(node_child)
        when 'tblPr'
          @table_properties = TableProperties.new(parent: self).parse(node_child)
        when 'trPr'
          @table_row_properties = TableRowProperties.new(parent: self).parse(node_child)
        when 'pPr'
          @paragraph_properties = ParagraphProperties.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.35.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.34.2 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.34.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.34.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.33.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.32.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.31.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.30.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.29.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.28.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.27.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.26.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.22.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb