class Rspreadsheet::Image
Represents an image included in the spreadsheet. The Image
can NOT exist “detached” from an spreadsheet
Attributes
mime[R]
Public Class Methods
new(worksheet,index)
click to toggle source
Calls superclass method
# File lib/rspreadsheet/image.rb, line 63 def initialize(worksheet,index) super(worksheet,index) @original_filename = nil end
Public Instance Methods
copy_to(ax,ay,worksheet)
click to toggle source
# File lib/rspreadsheet/image.rb, line 86 def copy_to(ax,ay,worksheet) img = worksheet.insert_image_to(ax,ay,@original_filename) img.height = height img.width = width end
height()
click to toggle source
# File lib/rspreadsheet/image.rb, line 101 def height; Tools.get_ns_attribute_value(xmlnode,'svg','height') end
height=(value)
click to toggle source
# File lib/rspreadsheet/image.rb, line 96 def height=(value); Tools.set_ns_attribute(xmlnode,'svg','height',value) end
initialize_from_file(filename,mime)
click to toggle source
# File lib/rspreadsheet/image.rb, line 68 def initialize_from_file(filename,mime) # ověřit, zda soubor na disku existuje TODO: tady by to chtělo zobecnit na IO raise 'File does not exist or it is not accessible' unless File.exist?(filename) @original_filename = filename @mime = mime self end
internal_filename()
click to toggle source
# File lib/rspreadsheet/image.rb, line 103 def internal_filename; Tools.get_ns_attribute_value(xml_image_subnode,'xlink','href') end
internal_filename=(value)
click to toggle source
# File lib/rspreadsheet/image.rb, line 104 def internal_filename=(value) Tools.set_ns_attribute(xml_image_subnode,'xlink','href', value ) end
move_to(ax,ay)
click to toggle source
# File lib/rspreadsheet/image.rb, line 79 def move_to(ax,ay) self.x = ax self.y = ay end
name()
click to toggle source
# File lib/rspreadsheet/image.rb, line 102 def name; Tools.get_ns_attribute_value(xmlnode, 'draw', 'name', nil) end
name=(value)
click to toggle source
# File lib/rspreadsheet/image.rb, line 97 def name=(value); Tools.set_ns_attribute(xmlnode,'draw','name', value) end
original_filename()
click to toggle source
# File lib/rspreadsheet/image.rb, line 84 def original_filename; @original_filename end
width()
click to toggle source
# File lib/rspreadsheet/image.rb, line 100 def width; Tools.get_ns_attribute_value(xmlnode,'svg','width') end
width=(value)
click to toggle source
# File lib/rspreadsheet/image.rb, line 95 def width=(value); Tools.set_ns_attribute(xmlnode,'svg','width', value) end
x()
click to toggle source
# File lib/rspreadsheet/image.rb, line 98 def x; Tools.get_ns_attribute_value(xmlnode,'svg','x') end
x=(value)
click to toggle source
TODO: put some sanity check for values into these
# File lib/rspreadsheet/image.rb, line 93 def x=(value); Tools.set_ns_attribute(xmlnode,'svg','x', value) end
xml_image_subnode()
click to toggle source
# File lib/rspreadsheet/image.rb, line 75 def xml_image_subnode xmlnode.find('./draw:image').first end
y()
click to toggle source
# File lib/rspreadsheet/image.rb, line 99 def y; Tools.get_ns_attribute_value(xmlnode,'svg','y') end
y=(value)
click to toggle source
# File lib/rspreadsheet/image.rb, line 94 def y=(value); Tools.set_ns_attribute(xmlnode,'svg','y', value) end