I try to add one image to my workbook/worksheet.
The Code :
wb.add_worksheet(:name => \"Doc1\", :page_setup => setup, :print_options => opt
An example on https://pramodbshinde.wordpress.com/2013/12/29/design-spreadsheets-using-axlsx-in-rails/ show the following line of code
img = File.expand_path(Rails.root+'app/assets/images/result.png')
In the lines where you set the image width and height you have them very small and you could be overlooking the image as this number is in pixels. Try setting them to higher number.
the following worked for me:
img = File.expand_path(Rails.root+'app/assets/images/result.png')
sheet.add_image(:image_src => img, :noMove => true) do |image|
image.width = 100
image.height = 150
image.start_at 2, 2
end
Here is another way you can achieve this:
Code:
img = File.open(Dir.glob("#{Rails.root}/app/assets/images/result.png, "r")