Class: XLSX::Cell
- Inherits:
-
Object
- Object
- XLSX::Cell
- Defined in:
- lib/xlsx/cell.rb
Instance Attribute Summary collapse
-
#col_number ⇒ Object
readonly
Returns the value of attribute col_number.
-
#row_number ⇒ Object
readonly
Returns the value of attribute row_number.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(row_number, col_number, value) ⇒ Cell
constructor
A new instance of Cell.
- #name ⇒ Object
Constructor Details
#initialize(row_number, col_number, value) ⇒ Cell
Returns a new instance of Cell.
30 31 32 33 34 |
# File 'lib/xlsx/cell.rb', line 30 def initialize(row_number, col_number, value) @row_number = row_number @col_number = col_number @value = value end |
Instance Attribute Details
#col_number ⇒ Object (readonly)
Returns the value of attribute col_number.
27 28 29 |
# File 'lib/xlsx/cell.rb', line 27 def col_number @col_number end |
#row_number ⇒ Object (readonly)
Returns the value of attribute row_number.
26 27 28 |
# File 'lib/xlsx/cell.rb', line 26 def row_number @row_number end |
#value ⇒ Object
Returns the value of attribute value.
28 29 30 |
# File 'lib/xlsx/cell.rb', line 28 def value @value end |
Class Method Details
.cell_name(row_number, col_number) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/xlsx/cell.rb', line 40 def self.cell_name(row_number, col_number) raise "Column #{col_number} out of range" if col_number > 701 if col_number <= 25 col_name = '' else c = col_number / 26 col_name = (?A.ord + c - 1).chr col_number = col_number % 26 end col_name += (?A.ord + col_number).chr "#{col_name}#{row_number + 1}" end |