Skip to content

Commit 3e73763

Browse files
committed
Improve sample code for Work taskpane.ts
1 parent 34ef63d commit 3e73763

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/taskpane/word.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ export async function run() {
1616
/**
1717
* Insert your Word code here
1818
*/
19-
const range = context.document.getSelection();
2019

21-
// Read the range text
22-
range.load("text");
20+
// insert a paragraph at the end of the document.
21+
const paragraph = context.document.body.insertParagraph("Hello World", Word.InsertLocation.end);
2322

24-
// Update font color
25-
range.font.color = "red";
23+
// change the paragraph color to blue.
24+
paragraph.font.color = "blue";
2625

2726
await context.sync();
28-
console.log(`The selected text was ${range.text}.`);
2927
});
30-
}
28+
}

0 commit comments

Comments
 (0)