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.21.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.20.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.19.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.18.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.18.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.17.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.16.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.15.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.14.2 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.14.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.14.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.13.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.12.2 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.12.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.12.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.11.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.10.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.9.1 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb
ooxml_parser-0.9.0 lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb