Sha256: b15e452ef252f060a68479d081aaee1e0b9725ba82c077deb361b52def108c18
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require_relative 'xlsx_row/xlsx_cell' module OoxmlParser # Single Row of XLSX class XlsxRow < OOXMLDocumentObject attr_accessor :cells, :height, :style, :hidden # @return [True, False] true if the row height has been manually set. attr_accessor :custom_height # @return [Integer] Indicates to which row in the sheet this <row> definition corresponds. attr_accessor :index def initialize(parent: nil) @cells = [] super end # Parse XlsxRow object # @param node [Nokogiri::XML:Element] node to parse # @return [XlsxRow] result of parsing def parse(node) node.attributes.each do |key, value| case key when 'customHeight' @custom_height = option_enabled?(node, 'customHeight') when 'ht' @height = OoxmlSize.new(value.value.to_f, :point) when 'hidden' @hidden = option_enabled?(node, 'hidden') when 'r' @index = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'c' @cells[Coordinates.new.parse_string(node_child.attribute('r').value.to_s).column_number.to_i - 1] = XlsxCell.new(parent: self).parse(node_child) end end self end end end
Version data entries
3 entries across 3 versions & 1 rubygems