Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
18 changes: 18 additions & 0 deletions api-examples-to-merge/CommentCollection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# CommentCollection


### add(content: string, cellAddress: string, contentType: contentType)

```js

Excel.run(async (context) => {
var range = context.workbook.getSelectedRange();
context.workbook.comments.add("text of the comment", range);
return context.sync();
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```
27 changes: 27 additions & 0 deletions api-examples-to-merge/comment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### Getter setter
```js
Excel.run(async (context) => {
var comment = context.workbook.comments.getItemAt(0);
comment.content = "new content for the comment";
return context.sync();
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```

### delete()

```js
Excel.run(async (context) => {
context.workbook.comments.getItem("{42D7DCA6-8FA5-4CA2-B089-107DFD534F00}").delete();
return context.sync();
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```
43 changes: 43 additions & 0 deletions api-examples-to-merge/commentReply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@


### Getter setter

Get a comment reply and change the content

```js
Excel.run(async (context) => {

var comment = context.workbook.comments.getItemByReplyID("{42D7DCA6-8FA5-4CA2-B089-107DFD534F00}");
context.load(comment);
return context.sync();

var reply = comment.replies.getItem("{42D7DCA6-8FA5-4CA2-B089-107DFD534F00}");
reply.content = "new content for the reply";
return context.sync();

}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```
### delete()

Delete a comment reply given reply ID

```js
Excel.run(async (context) => {
var comment = context.workbook.comments.getItemByReplyID("{42D7DCA6-8FA5-4CA2-B089-107DFD534F00}");
context.load(comment);
return context.sync();

comment.replies.getItem("{42D7DCA6-8FA5-4CA2-B089-107DFD534F00}").delete();
return context.sync();
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```
16 changes: 16 additions & 0 deletions api-examples-to-merge/commentReplyCollection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### add(content: string, contentType: contentType)
```js
Excel.run(async (context) => {
var comment = context.workbook.comments.getItemByCell("sheet1!A1");
context.load(comment);
return context.sync();

comment.replies.add("text of the reply");
return context.sync();
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```
Loading