-
Notifications
You must be signed in to change notification settings - Fork 63
/
word.rangelocation.yml
103 lines (84 loc) · 3.45 KB
/
word.rangelocation.yml
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
### YamlMime:TSEnum
name: Word.RangeLocation
uid: 'word!Word.RangeLocation:enum'
package: word!
fullName: Word.RangeLocation
summary: ''
remarks: >-
\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/25-paragraph/get-paragraph-on-insertion-point.yaml
await Word.run(async (context) => {
// Get the complete sentence (as range) associated with the insertion point.
const sentences: Word.RangeCollection = context.document
.getSelection()
.getTextRanges(["."] /* Using the "." as delimiter */, false /*means without trimming spaces*/);
sentences.load("$none");
await context.sync();
// Expand the range to the end of the paragraph to get all the complete sentences.
const sentencesToTheEndOfParagraph: Word.RangeCollection = sentences.items[0]
.getRange()
.expandTo(
context.document
.getSelection()
.paragraphs.getFirst()
.getRange(Word.RangeLocation.end)
)
.getTextRanges(["."], false /* Don't trim spaces*/);
sentencesToTheEndOfParagraph.load("text");
await context.sync();
for (let i = 0; i < sentencesToTheEndOfParagraph.items.length; i++) {
console.log(sentencesToTheEndOfParagraph.items[i].text);
}
});
```
isPreview: false
isDeprecated: false
fields:
- name: after
uid: 'word!Word.RangeLocation.after:member'
package: word!
summary: >-
The point after the object. If the object is a paragraph content control or table content control, it is the point
after the EOP or Table characters.
* \[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
value: '"After"'
- name: before
uid: 'word!Word.RangeLocation.before:member'
package: word!
summary: |-
For content control only. It is the point before the opening tag.
* \[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
value: '"Before"'
- name: content
uid: 'word!Word.RangeLocation.content:member'
package: word!
summary: |-
The range between 'Start' and 'End'.
* \[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
value: '"Content"'
- name: end
uid: 'word!Word.RangeLocation.end:member'
package: word!
summary: >-
The ending point of the object. For paragraph, it is the point before the EOP. For content control, it is the
point before the closing tag.
* \[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
value: '"End"'
- name: start
uid: 'word!Word.RangeLocation.start:member'
package: word!
summary: |-
The starting point of the object. For content control, it is the point after the opening tag.
* \[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
value: '"Start"'
- name: whole
uid: 'word!Word.RangeLocation.whole:member'
package: word!
summary: >-
The object's whole range. If the object is a paragraph content control or table content control, the EOP or Table
characters after the content control are also included.
* \[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
value: '"Whole"'