Skip to main content

Show.Comment

Show.Comment is an object type of the Presentation module (Office.show(iframe)). 14 methods.

Remarks​

Methods​

MethodDescription
appendText(text)Appends to the end of the comment text.
getAuthorName()Returns the comment author's name.
getDateTime()Returns the comment's creation time.
getParent()Returns the parent comment of this comment.
getPosition()Returns the position of the comment note icon relative to the slide.
getReplies()Returns this comment's replies.
getStyle()Returns the comment note style (symmetric with setStyle).
getText()Returns the comment text.
hasReplies()Returns whether there is at least one reply.
isReply()Returns whether this comment is a reply.
moveBy(distance)Moves the comment note by x and y, relative to its current position.
setPosition(position)Moves the comment note to an absolute position on the slide (use moveBy for a relative move).
setStyle(style)Changes the comment note style (symmetric with getStyle).
setText(text)Sets the comment text.

Method details​

appendText(text)​

Appends to the end of the comment text.

appendText(text: string): Promise<void>;

Parameters

NameTypeDescription
textstringText to append

Returns

none

getAuthorName()​

Returns the comment author's name.

getAuthorName(): Promise<string | null>;

Returns

Promise<string | null> - author name (an empty string when there is no author information). null when there is no target comment

getDateTime()​

Returns the comment's creation time.

getDateTime(): Promise<string | null>;

Returns

Promise<string | null> - creation time, 'YYYY-MM-DDTHH:mm:ss.SSS'. null when there is no target comment

getParent()​

Returns the parent comment of this comment.

getParent(): Promise<Comment>;

Returns

Promise<Comment> - parent comment; null when it is not a reply or there is no target comment

getPosition()​

Returns the position of the comment note icon relative to the slide.

getPosition(): Promise<CommentPosition | null>;

Returns

Promise<CommentPosition | null> - position of the comment note icon (in px). null when there is no target comment

getReplies()​

Returns this comment's replies.

getReplies(): Promise<Comment[]>;

Returns

Promise<Comment[]> - reply list; an empty array when there is no target comment

getStyle()​

Returns the comment note style (symmetric with setStyle). A comment that never had a style set is returned with the author's default style.

getStyle(): Promise<CommentStyle | null>;

Returns

Promise<CommentStyle | null> - note style; null when there is no target comment or the style is outside the presets

getText()​

Returns the comment text.

getText(): Promise<string | null>;

Returns

Promise<string | null> - comment text; null when there is no target comment

hasReplies()​

Returns whether there is at least one reply.

hasReplies(): Promise<boolean | null>;

Returns

Promise<boolean | null> - true when there are replies. null when there is no target comment

isReply()​

Returns whether this comment is a reply.

isReply(): Promise<boolean | null>;

Returns

Promise<boolean | null> - true when it is a reply. null when there is no target comment

moveBy(distance)​

Moves the comment note by x and y, relative to its current position.

moveBy(distance: { x: number; y: number }): Promise<void>;

Parameters

NameTypeDescription
distance{ x: number; y: number }Distance to move (in px). Positive = right/down

Returns

none

setPosition(position)​

Moves the comment note to an absolute position on the slide (use moveBy for a relative move).

setPosition(position: Partial<CommentPosition>): Promise<void>;

Parameters

NameTypeDescription
positionPartial<CommentPosition>{ x, y } (absolute coordinates in px). An omitted axis keeps its current value

Returns

none

setStyle(style)​

Changes the comment note style (symmetric with getStyle).

setStyle(style: CommentStyle): Promise<void>;

Parameters

NameTypeDescription
styleCommentStylenote style

Returns

none

setText(text)​

Sets the comment text. (Existing content is replaced.)

setText(text: string): Promise<void>;

Parameters

NameTypeDescription
textstringComment text

Returns

none