module RubyXL::LegacyCell
Attributes
formula[RW]
worksheet[RW]
Public Instance Methods
change_contents(data, formula_expression = nil)
click to toggle source
# File lib/rubyXL/cell.rb, line 99 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
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 125 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
inspect()
click to toggle source
# File lib/rubyXL/cell.rb, line 117 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
workbook()
click to toggle source
# File lib/rubyXL/cell.rb, line 17 def workbook @worksheet.workbook end