Skip to content

Commit 2c0d75a

Browse files
authored
[excel] (Range) Add sample for RangeHyperlink.documentReference (#324)
* Add sample for RangeHyperlink.documentReference * Fix grammar
1 parent e77aeda commit 2c0d75a

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

docs/docs-ref-autogen/excel/excelscript/excelscript.rangehyperlink.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,29 @@ properties:
5757
content: 'documentReference?: string;'
5858
return:
5959
type: string
60+
description: |-
61+
62+
63+
#### Examples
64+
65+
```TypeScript
66+
/**
67+
* This script creates a hyperlink in the current cell to a table.
68+
*/
69+
function main(workbook: ExcelScript.Workbook) {
70+
// Get the selected cell.
71+
const selectedCell = workbook.getActiveCell();
72+
73+
// Create a hyperlink from the current cell to a table named "Resources".
74+
const link : ExcelScript.RangeHyperlink = {
75+
documentReference: "Resources",
76+
screenTip: "Resources table",
77+
textToDisplay: "Go to table"
78+
} ;
79+
80+
selectedCell.setHyperlink(link)
81+
}
82+
```
6083
- name: screenTip
6184
uid: 'ExcelScript!ExcelScript.RangeHyperlink#screenTip:member'
6285
package: ExcelScript!

docs/sample-scripts/excel-scripts.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4710,6 +4710,24 @@
47104710
cell.setHyperlink(sampleHyperlink);
47114711
cell.getFormat().autofitColumns();
47124712
}
4713+
'ExcelScript.RangeHyperlink#documentReference:member':
4714+
- |-
4715+
/**
4716+
* This script creates a hyperlink in the current cell to a table.
4717+
*/
4718+
function main(workbook: ExcelScript.Workbook) {
4719+
// Get the selected cell.
4720+
const selectedCell = workbook.getActiveCell();
4721+
4722+
// Create a hyperlink from the current cell to a table named "Resources".
4723+
const link : ExcelScript.RangeHyperlink = {
4724+
documentReference: "Resources",
4725+
screenTip: "Resources table",
4726+
textToDisplay: "Go to table"
4727+
} ;
4728+
4729+
selectedCell.setHyperlink(link)
4730+
}
47134731
'ExcelScript.RangeSort#apply:member(1)':
47144732
- |-
47154733
/**

generate-docs/API Coverage Report.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,7 @@ ExcelScript.RangeFormat,"setVerticalAlignment(verticalAlignment)",Method,Poor,tr
25922592
ExcelScript.RangeFormat,"setWrapText(wrapText)",Method,Poor,true
25932593
ExcelScript.RangeHyperlink,N/A,Class,Fine,true
25942594
ExcelScript.RangeHyperlink,"address",Property,Fine,false
2595-
ExcelScript.RangeHyperlink,"documentReference",Property,Fine,false
2595+
ExcelScript.RangeHyperlink,"documentReference",Property,Fine,true
25962596
ExcelScript.RangeHyperlink,"screenTip",Property,Fine,false
25972597
ExcelScript.RangeHyperlink,"textToDisplay",Property,Fine,false
25982598
ExcelScript.RangeSort,N/A,Class,Fine,false

0 commit comments

Comments
 (0)