I would like to get some help regarding threaded comments in Excel. I also attached a sample project with example output files (in Excel and xml output folders) to demonstrate my issue. Here are some further details:
OS: Ubuntu 20.04, Windows Server 2019
Aspose Cells version: 21.8.0
Editor for Excel files: Microsoft Office 365 Online (both for editing and opening files)
Regarding the issue, I have an Excel file (test.xlsx) that contains threaded comments. I would like to process the comments in the file, both simple comments (equivalent to notes) and threaded comments because I experienced that threaded comments are also processed as notes, independently from the threaded comment itself.
However, in case I modify any of the note’s properties (e.g: Author or Note), it leads to a broken threaded comment structure: threaded comments are converted to simple notes when opening the output in Excel 365 online which means that only the note modifications will appear, threaded comment contents disappear. In contrast, when the note’s properties remain untouched, the threaded structure is correct too. What can be the cause of this problem? (Note: updating both the note’s and threaded comment’s properties was successful.)
I also checked the threaded comment xml files after unzipping the output Excel files in these 2 cases, but there was no difference.
Furthermore, I would like to ask a question too. I realized based on the info written to the console, that modifying a property of a threaded comment author will apply to every other instance of that same author. In other words, if I want to modify the name of an author, I do not need to loop through every comment and set its author’s name, but it is enough to do that once. Does this happen based on the author’s UserId field or what is the mechanism behind this?
@tamas.boldizsar,
Regarding the first part of the query where structure is broken for the threaded comments seems to be the expected behavior as author id value is linked with all the instance of that author in the collection of threaded comments. However when we modify the author, it will no more be linked with the threaded comments resulting into broken structure. However we are gathering more information about it and will share our feedback soon.
Similarly regarding the second part of the query, it also seems to be the expected behavior however we will share our feedback after detailed discussion.
We have logged your query into our database for a detailed analysis as below and will write back soon to share our comments:
Here is the issue id logged into our database: CELLSNETCORE-233 - Query about logic behind changing threaded comment author
Regarding the second part of the query, I accept that this is the expected behaviour and also agree with that. I understand now that “author id value is linked with all the instance of that author in the collection of threaded comments” as you explained and probably that’s why every instance gets modified upon updating only one author. That’s clear.
As for the first issue, however, I am surprised that this is the expected behaviour. Instead, I would expect that if I use a setter for a property of an object, then it gets modified and also the original structure is kept. In my case, if an Author field (e.g: Name) has a setter, I should be able to set its value without having a broken structure due to the modification in the output document, I guess. Or do I think something wrong? I might be missing some details or correlation of Author objects, but that would be my expectation.
1). The threaded comments structure will be broken.
If the comment’s note is changed, MS Excel will not process it as a threaded comment. It must be the limitation of MS Excel. So, please do not change the comment’s note and we will ignore any setting about comment’s note in the next (upcoming) fix.
2). If modifying a property of a threaded comment author will apply to every other instance of that same author.
MS Excel will gather all authors of all threaded comments into a pool, Now ThreadedComment.Author returns a reference in the pool. So, if you change it, all same users are changed. We support setting for this property, then you can only change the author for one threaded comment.
You should not change comment’s note. Moreover, in our next (upcoming) fix (we will share it with you when fix is available), Aspose.Cells will not set/change comment’s note even if you have changed in code.
Was this a planned fix for comment’s note or it was just triggered by my current issue?
Also, does this mean that if I want to search in comments’ content and replace some parts of its content in code, then it will not be visible in the output at all?
If so, then will there be any other possibility to do that?
Or will this only apply to comment notes that belong to a threaded comment in fact? Or to simple comments (notes) as well?
Generally, we post hot fixes in each week in the forums against new enhancements and other fixes for users. Our upcoming fix will include this enhancement/fix for comment’s note.
We will get back to you to clarify you about your doubts and queries.
@tamas.boldizsar,
1: If you set comment’s note, we will check whether it’s a threaded comment or not. If it’s a threaded comment, the setting will be ignored, otherwise the setting will effect.
2: We have changed ThreadedCommentAuthor.Author property as the following:
public ThreadedCommentAuthor Author {get;set;}
If you want to change the author as a new author, please try the following codes:
CommentCollection comments = worksheet.Comments;
Comment comment = comments[0];
ThreadedCommentCollection tcs = comment.ThreadedComments;
ThreadedCommentAuthorCollection authors = workbook.Worksheets.ThreadedCommentAuthors;
string au = tcs[0].Author.Name;
int index = authors.Add("Aspose", "S::[johnson.shi@asposenj.onmicrosoft.com](mailto:johnson.shi@asposenj.onmicrosoft.com)::bd07c1a8-5f37-4ecf-bd20-1f831c9015ce", "AD");
tcs[1].Author = authors[index];
@simon.zhao
Thank you for the fix! I have tried it and I experienced that when a comment is a threaded comment, note (Comment.Note) remains untouched despite modifying it.
Threaded comment structure is still broken however in case author of that comment (Comment.Author) is modified.
Is there any solution to this problem or should I accept it as an MS Excel limitation as discussed above?
@ahsaniqbalsidiqui
Thank you for the explanation! I still have a few questions and concerns, though.
This was proved by the fix as I mentioned above. I do have some concerns here however:
threaded comments inserted in Office 365 online are handled and displayed as notes in an installed version of Microsoft Excel 2016 for example. Also, modification to Comment.ThreadedComments.Notes does not affect the note displayed by Microsoft Excel 2016 - they are totally independent as I experienced.
One of our major features strongly relies on manipulating comments - all of them in a file. In this case, we have to deal with a comment’s note even if it is a threaded comment due to the reasons I detailed above to make sure that not only Comment.ThreadedComments.Notes got modified, but Comment.Note (which contains nearly the same as Comment.ThreadedComments.Notes) as well. Therefore, the lack of setting a comment’s note when it is a threaded comment will break a major feature on our side.
I would like to ask what was the cause and what is the intention of this fix?
Also, could you please suggest any alternatives for us to keep our features working?
It is possible in general - and even in the fix I got above - to modify a threaded comment author’s property through its certain properties (ThreadedCommentAuthor.Name, ThreadedCommentAuthor.UserId, ThreadedCommentAuthor.ProviderId) both through Workbook.Worksheets.ThreadedCommentAuthors and Comment.ThreadedComments.Author as well.
Why should I replace the whole object then as you suggested?
Also, what is exactly the change you mentioned? Is it that ThreadedCommentAuthor has now getter and setter? I assume it has not had so far or I might misunderstand something…
@tamas.boldizsar,
1: ThreadedComment is corrupted if Comment.Author is updated.
Yes, you’re right. Sorry for our confusion in the previous post.
In fact, modifying Comment.Note does not corrupt threaded comment , but the author of comment could not be changed.
The author of comment must be “tc={” + comment.ThreadedComments[0].Id +"}", otherwise the threaded comment will be corrupted, so you can not change the author.
Thanks for your information.
2: Why should I replace the whole object then as you suggested?
If you directly change ThreadedComment.Author.* , you will change all comments which refer to this author.
We will return a clone of ThreadedComment.Author, you can change the setting of ThreadedComment.Author.* , then set the ThreadedComment.Author = value.
So you have to iterate all threaded comments to update author, though maybe all threaded comments refers to the same user.
3: What is exactly the change you mentioned?
If you call ThreadedComment.Author = value, we only set use_id to ThreadedComment.
I understand this part now, thank you for the explanation!
However, modifying Comment.Note for a threaded comment is not going to have any effect as you detailed earlier. In my previous post I raised some concerns from our side that it will break major features. We should definitely set Comment.Note for a threaded comment as it is not the same as ThreadedComment.Notes. I also asked some questions regarding this problem, could you please answer them too?
I would like to ask what was the cause and what is the intention of this fix?
Also, could you please suggest any alternatives for us to keep our features working?
Which release is going to have this fix?
As for 2nd and 3rd points in your last post (regarding setting ThreadedComment.Author), I would like to clarify some things and ask a few questions.
If I understand right, the change you mentioned above means that it will be possible to set threaded comment author properties one by one by iterating over them. Is that right?
Also, will this change replace the previous method or will it still be possible to set threaded comment author properties through ThreadedComment.Author.* directly, which also modifies every other author of the same instance (so no iteration is needed to modify a certain author everywhere else)?
The issues you have found earlier (filed as CELLSNETCORE-233) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao
What does this fix “CELLSNETCORE-233 Enhancement for changing threaded comment’s author” contain exactly? Only modifying Comment.Note for a threaded comment does not have any effect anymore or something else too?
@tamas.boldizsar,
Please note:
1). Comment.Author could not be changed if it’s a threaded comment. Comment.Note could be changed though if it’s a threaded comment.
2). ThreadedComment.Author returns a clone of the ThreadedCommentAuthor object. If you want to change the author, you have to set it as ThreadedComment.Author = …