Macro issue setting comment on a cell


I’m new to OnlyOffice, just done a flathub install on a new CentOS 8 linux setup (my first time with Centos too!).

I want a macro to to set a comment in a cell / replace existing comment if there is one. I came up with this…

    oWorksheet = Api.GetActiveSheet();
    oActiveCell = oWorksheet.GetActiveCell();
    oComment = oActiveCell.GetComment();
    if ( oComment.GetText() === "" ) {
        oActiveCell.AddComment("Comment 1");
    } else {
        oActiveCell.AddComment("Comment 2");


If I run this on a cell with a comment already present then the comment is deleted and the new comment (“Comment 2”) is added to replace it. But, if there isn’t a comment already there then the “Comment 1” comment doesn’t get added. I can’t work out why that doesn’t work.

Additionally, I would like this macro to be run automatically when a cell in a range has a new value entered by the user (I have a macro in Excel for this that I wrote a few years ago). Is that possible with OnlyOffice?


Hello @stb68
Sorry for the late reply. We checked your macro. It should work properly. We found an issue and we added a bug to our internal tracklist (internal number - 56339). we have started working on it.
Sorry for inconvenience.