Class: RubyXL::Cell

Inherits:
OOXMLObject show all
Includes:
LegacyCell
Defined in:
lib/rubyXL/objects/sheet_data.rb

Overview

Constant Summary

Constants included from LegacyCell

LegacyCell::ERROR, LegacyCell::RAW_STRING, LegacyCell::SHARED_STRING

Instance Attribute Summary

Attributes included from LegacyCell

#formula, #worksheet

Instance Method Summary collapse

Methods included from LegacyCell

#border_bottom, #border_diagonal, #border_left, #border_right, #border_top, #change_border_bottom, #change_border_diagonal, #change_border_left, #change_border_right, #change_border_top, #change_contents, #change_fill, #change_font_bold, #change_font_color, #change_font_italics, #change_font_name, #change_font_size, #change_font_strikethrough, #change_font_underline, #change_horizontal_alignment, #change_text_wrap, #change_vertical_alignment, #fill_color, #font_color, #font_name, #font_size, #horizontal_alignment, #inspect, #is_bolded, #is_date?, #is_italicized, #is_struckthrough, #is_underlined, #text_wrap, #vertical_alignment, #workbook

Methods inherited from OOXMLObject

#add_to_zip, #before_write_xml, define_attribute, define_child_node, define_element_name, #dup, filepath, #initialize, obtain_class_variable, parse, parse_file, set_countable, set_namespaces, #write_xml

Constructor Details

This class inherits a constructor from RubyXL::OOXMLObject

Instance Method Details

#columnObject



38
39
40
# File 'lib/rubyXL/objects/sheet_data.rb', line 38

def column
  r && r.first_col
end

#column=(v) ⇒ Object



42
43
44
# File 'lib/rubyXL/objects/sheet_data.rb', line 42

def column=(v)
  self.r = RubyXL::Reference.new(row || 0, v)
end

#index_in_collectionObject



26
27
28
# File 'lib/rubyXL/objects/sheet_data.rb', line 26

def index_in_collection
  r.col_range.begin
end

#raw_valueObject



46
47
48
# File 'lib/rubyXL/objects/sheet_data.rb', line 46

def raw_value
  value_container && value_container.value
end

#raw_value=(v) ⇒ Object



50
51
52
53
# File 'lib/rubyXL/objects/sheet_data.rb', line 50

def raw_value=(v)
  self.value_container ||= RubyXL::CellValue.new
  value_container.value = v
end

#rowObject



30
31
32
# File 'lib/rubyXL/objects/sheet_data.rb', line 30

def row
  r && r.first_row
end

#row=(v) ⇒ Object



34
35
36
# File 'lib/rubyXL/objects/sheet_data.rb', line 34

def row=(v)
  self.r = RubyXL::Reference.new(v, column || 0)
end

#value(args = {}) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/rubyXL/objects/sheet_data.rb', line 55

def value(args = {})
  return raw_value if args[:raw]
  case datatype
  when RubyXL::Cell::SHARED_STRING then
    workbook.shared_strings_container[raw_value.to_i]
  else 
    if is_date? then workbook.num_to_date(raw_value.to_i)
    else raw_value
    end
  end
end