Sha256: 9ee98e15b6c595f28c7c1907a73187abd0458b7463077ac1221cb8cea1b74909

Contents?: true

Size: 1.29 KB

Versions: 40

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require_relative 'table_cell_line/line_join'
module OoxmlParser
  # Class for parsing Table Cell Lines
  class TableCellLine < OOXMLDocumentObject
    attr_accessor :fill, :dash, :line_join, :head_end, :tail_end, :align, :width, :cap_type, :compound_line_type

    def initialize(fill = nil, line_join = nil, parent: nil)
      @fill = fill
      @line_join = line_join
      super(parent: parent)
    end

    # Parse TableCellLine object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [TableCellLine] result of parsing
    def parse(node)
      @fill = PresentationFill.new(parent: self).parse(node)
      @line_join = LineJoin.new(parent: self).parse(node)
      node.attributes.each do |key, value|
        case key
        when 'w'
          @width = OoxmlSize.new(value.value.to_f, :emu)
        when 'algn'
          @align = value_to_symbol(value)
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'headEnd'
          @head_end = LineEnd.new(parent: self).parse(node_child)
        when 'tailEnd'
          @tail_end = LineEnd.new(parent: self).parse(node_child)
        when 'ln'
          return TableCellLine.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/row/cell/properties/table_cell_line.rb
ooxml_parser-0.20.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.19.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.18.1 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.18.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.17.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.16.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.15.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.14.2 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.14.1 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.14.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.13.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.12.2 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.12.1 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.12.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.11.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.10.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.9.1 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb
ooxml_parser-0.9.0 lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb