I try to add one image to my workbook/worksheet.
The Code :
wb.add_worksheet(:name => "Doc1", :page_setup => setup, :print_options => options) do |sheet|
img = File.expand_path('../logo.jpg', __FILE__)
sheet.add_image(:image_src => img, :noMove => true) do |image|
image.width = 7
image.height = 6
image.start_at 2, 2
end
...
end
But if i open the document there is no image on the worksheet, how can i fix this ?
And how is the correct path to the image? For this test i copy the jpg in my view folder, but usually all images in "app/assets/images/logo.jpg"
. I try it with img = File.expand_path('../assets/images/logo.jpg', __FILE__)
, but it fails with "No file found!"
Aucun commentaire:
Enregistrer un commentaire