Sha256: b38b78af20bcdab656a09dff8306703463943c0cd873f349b36c63ef3167166f
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module XLSX class Sheet attr_accessor :name # the name of this sheet attr_accessor :id, :hash, :workbook # :nodoc: attr_accessor :data # :nodoc: def initialize # :nodoc: @data = Hash.new end # Set the value of a cell def []=(row, column, value) set_cell(row, column, value) end # Get the value of a cell def [](row, column) cell = get_cell(row, column) return nil if cell.nil? case cell.type when 's' then @workbook.strings[cell.value] when 'n' then cell.value end end protected def get_cell(row, column) # :nodoc: hash = ::XLSX::Cell.storage_hash(row, column) @data[hash] ||= ::XLSX::Cell.new(self, row, column) end def set_cell(row, column, value) # :nodoc: cell = get_cell(row, column) cell.type = ::XLSX::Cell.type_of(value) case cell.type when 's' then cell.value = @workbook.register_string(value) when 'n' then cell.value = value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simonmenke-xlsx-0.0.1 | lib/xlsx/sheet.rb |