Description: Current; LibreOffice versions: 5.1, 6.0.5.2 OS: Elementary OS 0.4.1 x64 (a derivation of Ubuntu 16.04.2) Kernel: 4.4.0-131-generic File saving format: *.xlsx When I protect a sheet, the all comments I wrote on cells will be removed. The steps to reproduce the bug: 1. open a blank sheet 2. right clik on any cell and select the command of "insert comment" 3. write down some text 4. right clik on the current sheet name from the bottom of the sheet 5. select the command of "protect sheet" 6. press on "OK" button on the dialog window (so, give a blank password) 7. save the current file with "*.xlsx" (MS Excel 2007-2019) file extension and close Calc application 8. re-open the file Now it can be seen that there is no any comment on any cell. Steps to Reproduce: 1. open a blank sheet 2. right clik on any cell and select the command of "insert comment" 3. write down some text 4. right clik on the current sheet name from the bottom of the sheet 5. select the command of "protect sheet" 6. press on "OK" button on the dialog window (so, give a blank password) 7. save the current file with "*.xlsx" (MS Excel 2007-2019) file extension and close Calc application 8. re-open the file 9. see that there is no any comment on any cell Actual Results: The all written comments have gone. Expected Results: The comments can be seen when mouse pointer over the cells. On the other hand, the cells that have comments are specified by a tiny red square at the top-left of the cells. Reproducible: Always User Profile Reset: No Additional Info:
Related question on https://ask.libreoffice.org https://ask.libreoffice.org/en/question/162501/protecting-sheets-removes-the-all-cell-comments-libreoffice-calc-file-format-xlsx/
Repro with Version: 6.1.0.3 (x64) Build ID: efb621ed25068d70781dc026f7e9c5187a4decd1 CPU threads: 12; OS: Windows 10.0; UI render: GL; Locale: ru-RU (ru_RU); Calc: CL
I can reproduce it back to Version: 4.2.0.0.alpha1+ Build ID: fc8f44e82de4ebdd50ac5fbb9207cd1a59a927e3 but not in Version: 4.1.0.0.alpha1+ Build ID: a2c9d4f8bbde97f175bae4df771273a61251f40 it needs to be bisected with bibisect-42max repo
https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/commentsbuffer.cxx?r=3e1d3c25#139 https://opengrok.libreoffice.org/xref/core/sc/source/ui/unoobj/docuno.cxx?r=a6a5064c#4368 https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docfunc.cxx?r=206b5b26#1249 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/commentsbuffer.cxx?r=3e1d3c25#145 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/commentsbuffer.cxx?r=3e1d3c25#177
https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/workbookfragment.cxx?r=f87be145#497 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/worksheethelper.cxx?r=60bc2635#1567 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/worksheethelper.cxx?r=60bc2635#959 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/worksheethelper.cxx?r=60bc2635#1328 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/commentsbuffer.cxx?r=3e1d3c25#202 Note: CommentsFragment, CommentsBuffer , Comment are all different. Calling importOoxFragment here will not directly trigger Comment::finalizeImport , but tries to call CommentsFragment::finalizeImport, which is just the (empty) inherited method(FragmentHandler2::finalizeImport(). So we don't need to worry about the following code. https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/worksheetfragment.cxx?r=f87be145#353 **** https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/workbookfragment.cxx?r=f87be145#437 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/workbookfragment.cxx?r=f87be145#480 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/workbookfragment.cxx?r=f87be145#334 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/workbookfragment.cxx?r=f87be145#256 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/workbookhelper.cxx?r=fabbeb7a#958 https://opengrok.libreoffice.org/xref/core/oox/source/core/xmlfilterbase.cxx?r=60bc2635#338 etc. and the code eventually calls https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/worksheetfragment.cxx?r=f87be145#638 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/worksheethelper.cxx?r=60bc2635#1562 https://opengrok.libreoffice.org/xref/core/sc/source/filter/oox/worksheethelper.cxx?r=60bc2635#947 as importSheetFragments comes before (*aIt)->finalizeDrawingImport() in WorkbookFragment::finalizeImport(), comment is not added to the protected sheets.
This seems to have begun at the below commit. Adding Cc: to Noel Power ; Could you possibly take a look at this one? Thanks 1dd01719cbf3c784715206f9c204705d1b8c31ad is the first bad commit commit 1dd01719cbf3c784715206f9c204705d1b8c31ad Author: Matthew Francis <mjay.francis@gmail.com> Date: Sat Sep 5 19:31:33 2015 +0800 source-hash-8ce1124359783df750d176b8390b4eb0f54fb6ba commit 8ce1124359783df750d176b8390b4eb0f54fb6ba Author: Noel Power <noel.power@suse.com> AuthorDate: Thu Aug 1 14:29:34 2013 +0100 Commit: Noel Power <noel.power@suse.com> CommitDate: Thu Aug 1 16:59:22 2013 +0100 2nd step to export SheetProtection fdo#64753, actually export the data Change-Id: Id9fa1f9b917f9df8ca0ead02dfd5405388039b4b
*** Bug 129053 has been marked as a duplicate of this bug. ***
This looks more like an import time problem: - Excel-made xlsx file with comment is opened without comment in Calc - Calc-made xlsx file with comment is opened with comment in Excel but without comment in Calc.
Created attachment 156240 [details] Example ods made in Calc, saved as xlsx then opened in Excel
Created attachment 156241 [details] Password protected ods with comment password is: hello
Created attachment 156242 [details] Password protected xlsx with comment password is: hello
Created attachment 156243 [details] Excel made file opened in Excel and Calc
LO 3.6 round-tripping attachment 156241 [details]: no comments exported, not protected. LO 4.0: comment exported/imported, not protected. Opens XLSX attachment 156242 [details] as protected though (and of course no comment). So comment EXPORT support first came in the 4.0 range https://cgit.freedesktop.org/libreoffice/core/log/?id=3238606c8470f3eaeada3fc601e186ec5cfac925&qt=range&q=f9a453fb01908e16032abdbf1f895666e1d260a6..20d4cd5e08c1400fcc5ae5eb45861f429b914969&ofs=50 P.S. LO 3.5 can read the non-protected comments generated by LO 4.0.
Unfortunately, I hadn't bothered to first check if this was still a problem. comment have been importing since 6.4.0.2. author Noel Grandin on 2020-01-01 09:37:37 +0100 commit 4992d61600536fe14b97b718dbb11f00e936c6a9 tdf#129228 speedup opening of xlsx file with lots of comments
(In reply to Justin L from comment #14) > Unfortunately, I hadn't bothered to first check if this was still a problem. > comment have been importing since 6.4.0.2. > > author Noel Grandin on 2020-01-01 09:37:37 +0100 > commit 4992d61600536fe14b97b718dbb11f00e936c6a9 > tdf#129228 speedup opening of xlsx file with lots of comments I do confirm it. Nice finding. Unittest added in https://gerrit.libreoffice.org/c/core/+/125874
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/224026a38ddc4008d1c73fa1ba95f672f03fac63 tdf#119190: sc_subsequent_filters_test2: Add unittest It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.