summaryrefslogtreecommitdiffhomepage
path: root/examples/hyperlinked_image_example.md
blob: e79237da69375890173b79d3a436559e0bbf2304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Description

You could add hyerlinks to images.

## Code

```ruby
require 'axlsx'

p = Axlsx::Package.new
wb = p.workbook

image = File.expand_path('assets/image1.jpeg')

wb.add_worksheet(name: 'Image') do |sheet|
  sheet.add_image(image_src: image, start_at: 'B2', width: 300, height: 300, hyperlink: 'https://github.com/caxlsx') do |img|
    img.hyperlink.tooltip = 'Labeled Link'
  end
end

p.serialize 'hyperlinked_image_example.xlsx'
```

## Output

![Output](images/hyperlinked_image_example.png "Output")