Excel.CommentReplyCollection class
Represents a collection of comment reply objects that are part of the comment.
- Extends
Remarks
Properties
context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
items | Gets the loaded child items in this collection. |
Methods
add(content, content |
Creates a comment reply for a comment. |
add(content, content |
Creates a comment reply for a comment. |
get |
Gets the number of comment replies in the collection. |
get |
Returns a comment reply identified by its ID. |
get |
Gets a comment reply based on its position in the collection. |
load(options) | Queues up a command to load the specified properties of the object. You must call |
load(property |
Queues up a command to load the specified properties of the object. You must call |
load(property |
Queues up a command to load the specified properties of the object. You must call |
toJSON() | Overrides the JavaScript |
Property Details
context
The request context associated with the object. This connects the add-in's process to the Office host application's process.
context: RequestContext;
Property Value
items
Gets the loaded child items in this collection.
readonly items: Excel.CommentReply[];
Property Value
Method Details
add(content, contentType)
Creates a comment reply for a comment.
add(content: CommentRichContent | string, contentType?: Excel.ContentType): Excel.CommentReply;
Parameters
- content
-
Excel.CommentRichContent | string
The comment's content. This can be either a string or a CommentRichContent
object (e.g., for comments with mentions). [Api set: ExcelApi 1.10 for string, 1.11 for CommentRichContent object]
- contentType
- Excel.ContentType
Optional. The type of content contained within the comment. The default value is enum ContentType.Plain
. [Api set: ExcelApi 1.10 for Enum ContentType.Plain, 1.11 for Enum ContentType.Mention]
Returns
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comment/comment-replies.yaml
await Excel.run(async (context) => {
// Adds a reply to the first comment in this worksheet.
const sheet = context.workbook.worksheets.getItem("Comments");
const comment = sheet.comments.getItemAt(0);
comment.replies.add("Add content to this worksheet.");
await context.sync();
});
add(content, contentTypeString)
Creates a comment reply for a comment.
add(content: CommentRichContent | string, contentTypeString?: "Plain" | "Mention"): Excel.CommentReply;
Parameters
- content
-
Excel.CommentRichContent | string
The comment's content. This can be either a string or a CommentRichContent
object (e.g., for comments with mentions). [Api set: ExcelApi 1.10 for string, 1.11 for CommentRichContent object]
- contentTypeString
-
"Plain" | "Mention"
Optional. The type of content contained within the comment. The default value is enum ContentType.Plain
. [Api set: ExcelApi 1.10 for Enum ContentType.Plain, 1.11 for Enum ContentType.Mention]
Returns
Remarks
getCount()
Gets the number of comment replies in the collection.
getCount(): OfficeExtension.ClientResult<number>;
Returns
OfficeExtension.ClientResult<number>
Remarks
getItem(commentReplyId)
Returns a comment reply identified by its ID.
getItem(commentReplyId: string): Excel.CommentReply;
Parameters
- commentReplyId
-
string
The identifier for the comment reply.
Returns
Remarks
getItemAt(index)
Gets a comment reply based on its position in the collection.
getItemAt(index: number): Excel.CommentReply;
Parameters
- index
-
number
The index value of the comment reply to be retrieved. The collection uses zero-based indexing.
Returns
Remarks
load(options)
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(options?: Excel.Interfaces.CommentReplyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.CommentReplyCollection;
Parameters
Provides options for which properties of the object to load.
Returns
load(propertyNames)
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(propertyNames?: string | string[]): Excel.CommentReplyCollection;
Parameters
- propertyNames
-
string | string[]
A comma-delimited string or an array of strings that specify the properties to load.
Returns
load(propertyNamesAndPaths)
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(propertyNamesAndPaths?: OfficeExtension.LoadOption): Excel.CommentReplyCollection;
Parameters
- propertyNamesAndPaths
- OfficeExtension.LoadOption
propertyNamesAndPaths.select
is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand
is a comma-delimited string that specifies the navigation properties to load.
Returns
toJSON()
Overrides the JavaScript toJSON()
method in order to provide more useful output when an API object is passed to JSON.stringify()
. (JSON.stringify
, in turn, calls the toJSON
method of the object that is passed to it.) Whereas the original Excel.CommentReplyCollection
object is an API object, the toJSON
method returns a plain JavaScript object (typed as Excel.Interfaces.CommentReplyCollectionData
) that contains an "items" array with shallow copies of any loaded properties from the collection's items.
toJSON(): Excel.Interfaces.CommentReplyCollectionData;
Returns
Office Add-ins