Created attachment 31568 [details] a .tar.gz generated using "ant -f patch.xml" for supporting adding comments The attached is a .tar.gz generated using "ant -f patch.xml". The goal of the patch is to allow adding and saving of new comments, while the existing support was mostly useful for reading them. I will gladly accept feedback on how to better structure the changes. Includes test case.
Thanks for this At first glance, the way of adding comments to a paragraph doesn't look quite right to me. From the unit test, it doesn't look too bad for adding a comment to a paragraph you're creating, but it doesn't look very good for the edit case. Not certain what it should be, sorry, but the current way doesn't quite feel right... Something a bit like the unit test which is an example might be good too!
Created attachment 33570 [details] a .tar.gz generated using "ant -f patch.xml" for supporting adding and editing comments based on a mixture of the previous patch, logic from footnote and sweat. In general a bit confused when to use create/add/get I tried to be consistent but I am afraid there is not much precedent. I also think there is a real need for an AbstractBody class, the code duplication is getting pretty strong.
Created attachment 33571 [details] 33570: a .tar.gz generated using "ant -f patch.xml" for supporting adding and editing comments fixes a bug in the previous patch when having perfectly overlapping commentRanges
The comment feature has been supported, should be included in the upcoming Apache POI 5.0.1.