summaryrefslogtreecommitdiffhomepage
path: root/examples/hyperlinked_image_example.md
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hyperlinked_image_example.md')
-rw-r--r--examples/hyperlinked_image_example.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/hyperlinked_image_example.md b/examples/hyperlinked_image_example.md
new file mode 100644
index 00000000..e79237da
--- /dev/null
+++ b/examples/hyperlinked_image_example.md
@@ -0,0 +1,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")