Adding image to Excel file generated by Axlsx.?

送分小仙女□ 提交于 2019-12-02 06:11:56

This looks correct to me as well, and is inline with the example in the gem.

wb.add_worksheet(:name => "Image with Hyperlink") do |sheet|
  img = File.expand_path('../image1.jpeg', __FILE__)
  # specifying the :hyperlink option will add a hyper link to your image.
  # @note - Numbers does not support this part of the specification.
  sheet.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink=>"http://axlsx.blogspot.com") do |image|
    image.width = 7
    image.height = 6
    image.hyperlink.tooltip = "Labeled Link"
    image.start_at 2, 2
  end
end

There is a possibility that a bug was introduced in the version you are using.

As we discussed on #axlsx, lets try this against master on github and if it does prove to be a bug in the version you are using, I'll push out a new release.

Best,

randym

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!