module RubyXL::LegacyCell
Attributes
formula[RW]
worksheet[RW]
Public Instance Methods
border_bottom()
click to toggle source
returns cell's bottom border
# File lib/rubyXL/cell.rb, line 248 def border_bottom() return get_border(:bottom) end
border_diagonal()
click to toggle source
returns cell's diagonal border
# File lib/rubyXL/cell.rb, line 253 def border_diagonal() return get_border(:diagonal) end
border_left()
click to toggle source
returns cell's left border
# File lib/rubyXL/cell.rb, line 238 def border_left() return get_border(:left) end
border_right()
click to toggle source
returns cell's right border
# File lib/rubyXL/cell.rb, line 243 def border_right() return get_border(:right) end
border_top()
click to toggle source
returns cell's top border
# File lib/rubyXL/cell.rb, line 233 def border_top() return get_border(:top) end
change_border(direction, weight)
click to toggle source
# File lib/rubyXL/cell.rb, line 117 def change_border(direction, weight) validate_worksheet self.style_index = workbook.modify_border(self.style_index, direction, weight) end
change_border_bottom(weight = 'thin')
click to toggle source
# File lib/rubyXL/cell.rb, line 137 def change_border_bottom(weight = 'thin') warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead." change_border(:bottom, weight) end
change_border_diagonal(weight = 'thin')
click to toggle source
# File lib/rubyXL/cell.rb, line 142 def change_border_diagonal(weight = 'thin') warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead." change_border(:diagonal, weight) end
change_border_left(weight = 'thin')
click to toggle source
# File lib/rubyXL/cell.rb, line 127 def change_border_left(weight = 'thin') warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead." change_border(:left, weight) end
change_border_right(weight = 'thin')
click to toggle source
# File lib/rubyXL/cell.rb, line 132 def change_border_right(weight = 'thin') warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead." change_border(:right, weight) end
change_border_top(weight = 'thin')
click to toggle source
# File lib/rubyXL/cell.rb, line 122 def change_border_top(weight = 'thin') warn "[DEPRECATION] `#{__method__}` is deprecated. Please use `change_border` instead." change_border(:top, weight) end
change_contents(data, formula_expression = nil)
click to toggle source
# File lib/rubyXL/cell.rb, line 147 def change_contents(data, formula_expression = nil) validate_worksheet if formula_expression then self.datatype = nil self.formula = RubyXL::Formula.new(:expression => formula_expression) else self.datatype = case data when Date, Integer, Float then nil else RubyXL::DataType::RAW_STRING end end data = workbook.date_to_num(data) if data.is_a?(Date) self.raw_value = data end
change_fill(rgb = 'ffffff')
click to toggle source
changes fill color of cell
# File lib/rubyXL/cell.rb, line 22 def change_fill(rgb = 'ffffff') validate_worksheet Color.validate_color(rgb) self.style_index = workbook.modify_fill(self.style_index, rgb) end
change_font_bold(bolded = false)
click to toggle source
Changes font bold settings of cell
# File lib/rubyXL/cell.rb, line 67 def change_font_bold(bolded = false) validate_worksheet font = get_cell_font.dup font.set_bold(bolded) update_font_references(font) end
change_font_color(font_color = '000000')
click to toggle source
Changes font color of cell
# File lib/rubyXL/cell.rb, line 48 def change_font_color(font_color = '000000') validate_worksheet Color.validate_color(font_color) font = get_cell_font.dup font.set_rgb_color(font_color) update_font_references(font) end
change_font_italics(italicized = false)
click to toggle source
Changes font italics settings of cell
# File lib/rubyXL/cell.rb, line 58 def change_font_italics(italicized = false) validate_worksheet font = get_cell_font.dup font.set_italic(italicized) update_font_references(font) end
change_font_name(new_font_name = 'Verdana')
click to toggle source
Changes font name of cell
# File lib/rubyXL/cell.rb, line 29 def change_font_name(new_font_name = 'Verdana') validate_worksheet font = get_cell_font.dup font.set_name(new_font_name) update_font_references(font) end
change_font_size(font_size = 10)
click to toggle source
Changes font size of cell
# File lib/rubyXL/cell.rb, line 38 def change_font_size(font_size = 10) validate_worksheet raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float) font = get_cell_font.dup font.set_size(font_size) update_font_references(font) end
change_font_strikethrough(struckthrough = false)
click to toggle source
# File lib/rubyXL/cell.rb, line 84 def change_font_strikethrough(struckthrough = false) validate_worksheet font = get_cell_font.dup font.set_strikethrough(struckthrough) update_font_references(font) end
change_font_underline(underlined = false)
click to toggle source
Changes font underline settings of cell
# File lib/rubyXL/cell.rb, line 76 def change_font_underline(underlined = false) validate_worksheet font = get_cell_font.dup font.set_underline(underlined) update_font_references(font) end
change_horizontal_alignment(alignment = 'center')
click to toggle source
changes horizontal alignment of cell
# File lib/rubyXL/cell.rb, line 100 def change_horizontal_alignment(alignment = 'center') validate_worksheet self.style_index = workbook.modify_alignment(self.style_index, true, alignment) end
change_text_wrap(wrap = false)
click to toggle source
changes wrap of cell
# File lib/rubyXL/cell.rb, line 112 def change_text_wrap(wrap = false) validate_worksheet self.style_index = workbook.modify_text_wrap(self.style_index, wrap) end
change_vertical_alignment(alignment = 'center')
click to toggle source
changes vertical alignment of cell
# File lib/rubyXL/cell.rb, line 106 def change_vertical_alignment(alignment = 'center') validate_worksheet self.style_index = workbook.modify_alignment(self.style_index, false, alignment) end
fill_color()
click to toggle source
returns cell's fill color
# File lib/rubyXL/cell.rb, line 203 def fill_color() validate_worksheet return workbook.get_fill_color(get_cell_xf) end
font_color()
click to toggle source
# File lib/rubyXL/cell.rb, line 197 def font_color() validate_worksheet get_cell_font.get_rgb_color || '000000' end
font_name()
click to toggle source
# File lib/rubyXL/cell.rb, line 187 def font_name() validate_worksheet get_cell_font.get_name end
font_size()
click to toggle source
# File lib/rubyXL/cell.rb, line 192 def font_size() validate_worksheet get_cell_font.get_size end
font_switch(change_type, arg)
click to toggle source
Performs correct modification based on what type of change_type is specified
# File lib/rubyXL/cell.rb, line 265 def font_switch(change_type, arg) case change_type when Worksheet::NAME then change_font_name(arg) when Worksheet::SIZE then change_font_size(arg) when Worksheet::COLOR then change_font_color(arg) when Worksheet::ITALICS then change_font_italics(arg) when Worksheet::BOLD then change_font_bold(arg) when Worksheet::UNDERLINE then change_font_underline(arg) when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg) else raise 'Invalid change_type' end end
horizontal_alignment()
click to toggle source
returns cell's horizontal alignment
# File lib/rubyXL/cell.rb, line 209 def horizontal_alignment() validate_worksheet xf_obj = get_cell_xf return nil if xf_obj.alignment.nil? xf_obj.alignment.horizontal end
inspect()
click to toggle source
# File lib/rubyXL/cell.rb, line 257 def inspect str = "#<#{self.class}(#{row},#{column}): #{raw_value.inspect}" str += " =#{self.formula.expression}" if self.formula str += ", datatype = #{self.datatype}, style_index = #{self.style_index}>" return str end
is_bolded()
click to toggle source
returns if font is bolded
# File lib/rubyXL/cell.rb, line 172 def is_bolded() validate_worksheet get_cell_font.is_bold end
is_italicized()
click to toggle source
returns if font is italicized
# File lib/rubyXL/cell.rb, line 166 def is_italicized() validate_worksheet get_cell_font.is_italic end
is_struckthrough()
click to toggle source
# File lib/rubyXL/cell.rb, line 182 def is_struckthrough() validate_worksheet get_cell_font.is_strikethrough end
is_underlined()
click to toggle source
# File lib/rubyXL/cell.rb, line 177 def is_underlined() validate_worksheet get_cell_font.is_underlined end
text_wrap()
click to toggle source
returns cell's wrap
# File lib/rubyXL/cell.rb, line 225 def text_wrap() validate_worksheet xf_obj = get_cell_xf return nil if xf_obj.alignment.nil? xf_obj.alignment.wrap_text end
vertical_alignment()
click to toggle source
returns cell's vertical alignment
# File lib/rubyXL/cell.rb, line 217 def vertical_alignment() validate_worksheet xf_obj = get_cell_xf return nil if xf_obj.alignment.nil? xf_obj.alignment.vertical end
workbook()
click to toggle source
# File lib/rubyXL/cell.rb, line 17 def workbook @worksheet.workbook end