SetAuthorName

function SetAuthorName(sAuthorName: string = null): ApiComment

Description

Sets the comment author's name.

Parameters

sAuthorNamestringdefault: null

The comment author's name.

Returns

ApiComment

Try It

var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is just a sample text");
Api.AddComment(oParagraph, "comment", "John Smith");
var aComments = oDocument.GetAllComments();
aComments[0].SetAuthorName("Mark Potato");
oParagraph = Api.CreateParagraph();
oParagraph.AddText("The comment author's name was changed");
oDocument.Push(oParagraph);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).