-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto editor code 3
34 lines (22 loc) · 933 Bytes
/
auto editor code 3
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
function findText(item) {
Logger.log(item)
//search for the text
var searchResult
Logger.log(item)
searchResult = DocumentApp.getActiveDocument().getBody().findText(item)
//change backgroungcolor of the searchedtext
while(searchResult !== null){
searchResult.getElement().asText().setBackgroundColor(searchResult.getStartOffset(), searchResult.getEndOffsetInclusive(), "#FF0000")
searchResult = DocumentApp.getActiveDocument().getBody().findText(item,searchResult)
}
}
function higilightproblem(){
findText("very")
findText("totally")
}
function outArray() {
let arr = ["very"," the ", "this", " is "]
for (let i = 0; i < arr.length; i++) {
findText(arr[i])
}
}