Sha256: 06ba9578975fa3f1d477ab16493573d3c6d4bf73bc3a99e927acfcb4cf646ec7

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

module OoxmlParser
  class CellMerge
    attr_accessor :type, :count_of_merged_cells, :value

    def initialize(type = 'horizontal', value = nil, count_of_merged_cells = 2)
      @type = type
      @count_of_merged_cells = count_of_merged_cells
      @value = value
    end

    # Parse Merge data
    # @param [Nokogiri::XML:Element] node with Merge data
    # @return [CellMerge] value of CellMerge
    def self.parse(node)
      merge = CellMerge.new
      merge.count_of_merged_cells = node.attribute('count_rows_in_span').nil? ? nil : node.attribute('count_rows_in_span').value
      merge.value = node.attribute('val').nil? ? nil : node.attribute('val').value.to_sym
      merge.type = node.attribute('type').nil? ? nil : node.attribute('type').value.to_sym
      merge
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb