Comment
This topic describes the API operations that are related to the Comment object in presentation documents.
Comments
ActivePresentation.Slides.Comments
Obtains all comments in a presentation.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Commentsexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain all comments in a presentation. await app.ActivePresentation.Slides.Comments; }
Methods
ActivePresentation.Slides.Comments.Add()
You can add comments by using the Add() method.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Add({ SlideId, Text, Replyer })expression: the document type application object.
Parameters
Property
Type
Required
Description
SlideId
Number
Yes
The ID of the slide.
Text
String
Yes
The text of the comment.
Replyer
Object
Yes
The information about the comment.
Description of the Replyer parameter
Property
Type
Required
Description
AuthorName
String
Yes
The name of the author.
AuthorId
String
Yes
The ID of the author.
CommentId
String
Yes
The ID of the comment.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the first comment. let item1 = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1); let SlideId = await item1.SlideId; let Text ='This is a new comment'; let Author = await item1.Author; let AuthorId = await item1.AuthorId; let CommentId = await item1.CommentId; // Add a comment. await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Add({ SlideId, Text, Replyer: { Author, AuthorId, CommentId, }, }); }
ActivePresentation.Slides.Comments.GoToCommentItem()
You can jump to the position of a comment by using the GoToCommentItem() method.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.GoToCommentItem({ SlideId, CommentId })expression: the document type application object.
Parameters
Property
Type
Required
Description
SlideId
Number
Yes
The ID of the slide.
CommentId
String
Yes
The ID of the comment.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the first comment. let item1 = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1); let SlideId = await item1.SlideId; let CommentId = await item1.CommentId; // Jump to the position of the specified comment. await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.GoToCommentItem({ SlideId, CommentId }); }
Property
ActivePresentation.Slides.Comments.Count
You can obtain the total number of comments by using the Count property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Countexpression: the document type application object.
shil
async function example() { await instance.ready(); const app = instance.Application; // Obtain the total number of comments. const count = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Count; console.log(count); }
Comment
ActivePresentation.Slides.Comments.Item()
Obtains a single Comment object.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index)expression: the document type application object.
Parameters
Property
Type
Required
Description
Index
Number
Yes
The index number of the comment.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the first comment. let item1 = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1); console.log(item1); }
Properties
ActivePresentation.Slides.Comments.Item(Index).Author
You can obtain the author of a comment by using the Author property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index).Authorexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the author of the first comment. let Author = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1).Author; console.log(Author); }
ActivePresentation.Slides.Comments.Item(Index).AuthorId
You can obtain the author ID of a comment by using the AuthorId property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index).AuthorIdexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the author ID of the first comment. let AuthorId = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1).AuthorId; console.log(AuthorId); }
ActivePresentation.Slides.Comments.Item(Index).CommentId
You can obtain the ID of a comment by using the CommentId property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index).CommentIdexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ID of the first comment. let CommentId = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1).CommentId; console.log(CommentId); }
ActivePresentation.Slides.Comments.Item(Index).DateTime
You can obtain the timestamp of a comment by using the DateTime property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index).DateTimeexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the timestamp of the first comment. let DateTime = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1).DateTime; console.log(DateTime); }
ActivePresentation.Slides.Comments.Item(Index).Replies
You can obtain a list of replies to a comment by using the Replies property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index).Repliesexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the list of replies to the first comment. let Replies = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1).Replies; console.log(Replies); }
ActivePresentation.Slides.Comments.Item(Index).SlideId
You can obtain the ID of the slide which a comment is from by using the SlideId property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index).SlideIdexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the ID of the slide which the first comment is from. let SlideId = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1).SlideId; console.log(SlideId); }
ActivePresentation.Slides.Comments.Item(Index).Text
You can obtain the text of a comment by using the Text property.
Only JS-SDK V1.1.14 and later support this feature.
Only PCs support this feature.
Syntax
expression.ActivePresentation.Slides.Comments.Item(Index).Textexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the text of the first comment. let Text = await app.ActivePresentation.SlideShowWindow.View.Slide.Comments.Item(1).Text; console.log(Text); }