summaryrefslogtreecommitdiffhomepage
path: root/examples/hyperlink_example.md
diff options
context:
space:
mode:
authorWeston Ganger <[email protected]>2022-09-16 18:49:27 -0700
committerStefan Daschek <[email protected]>2022-09-17 20:31:49 +0200
commit20c7572361fa9b0ac79cc9f44ae0626aa8565cd8 (patch)
tree00f54a0107b4ed6716271c0a47436ef6a5a974fc /examples/hyperlink_example.md
parente975a2451ae3c5f6eb62bfbfea33be3bb9f2cb14 (diff)
downloadcaxlsx-20c7572361fa9b0ac79cc9f44ae0626aa8565cd8.tar.gz
caxlsx-20c7572361fa9b0ac79cc9f44ae0626aa8565cd8.zip
Clarify Hyperlinks Example for Internal Links
Diffstat (limited to 'examples/hyperlink_example.md')
-rw-r--r--examples/hyperlink_example.md23
1 files changed, 14 insertions, 9 deletions
diff --git a/examples/hyperlink_example.md b/examples/hyperlink_example.md
index f6d21ca9..b732042a 100644
--- a/examples/hyperlink_example.md
+++ b/examples/hyperlink_example.md
@@ -10,17 +10,22 @@ require 'axlsx'
p = Axlsx::Package.new
wb = p.workbook
-wb.add_worksheet(name: 'Hyperlinks') do |sheet|
- # external references
- sheet.add_row ['axlsx']
- sheet.add_hyperlink location: 'https://github.com/caxlsx/caxlsx', ref: 'A1'
- # internal references
- sheet.add_hyperlink location: "'Next Sheet'!A1", ref: 'A2', target: :sheet
- sheet.add_row ['next sheet']
+wb.add_worksheet(name: 'Hyperlinks Examples') do |sheet|
+ # External References (HTML Links)
+ sheet.add_row ["External Link:", "Click here to see caxlsx on Github"]
+ sheet.add_hyperlink location: 'https://github.com/caxlsx/caxlsx', ref: "B1"
+
+ # Internal References (Links pointing to within the Workbook)
+ sheet.add_row ["Internal Link:", "Click here to go to 'My Other Sheet Cell B1'"]
+ sheet.add_hyperlink(
+ location: "'My Other Sheet'!B1", ### This link will point to Cell B1 of the Worksheet named "My Other Sheet".
+ target: :sheet, ### This is :external by default. If you set it to anything else, the location is interpreted to be the current workbook.
+ ref: 'B2' ### Cell location of the link in this sheet
+ )
end
-wb.add_worksheet(name: 'Next Sheet') do |sheet|
- sheet.add_row ['hello!']
+wb.add_worksheet(name: 'My Other Sheet') do |sheet|
+ sheet.add_row ['Hello', 'World']
end
p.serialize 'hyperlink_example.xlsx'