Created attachment 134188 [details] Example source file Attached file has two sheets, with cell validation in the B1 cells. When copy-pasting the B1 cell from both sheets to the firsd sheet of a new spreadsheet document, the sheet reference part of the validation source becomes a #REF! error: $Sheet2.$A$1:$A$3 becomes $#REF!.$A$1:$A$3 This may make some sense in itself, as there is no second sheet in the new document. Adding a new sheet and pasting there gives correct results. The main problem is that the validation source with #REF! error can be saved to both ODS and XLSX format, and in the case of XLSX, Excel 2013 considers it an invalid file.
Created attachment 134189 [details] Cells with validation pasted to the first sheet In A2 we can see the #REF! error.
Created attachment 134190 [details] Cells with validation pasted to the first sheet - in XLSX format
Created attachment 134191 [details] Original cell and its pasted version in a new file
Created attachment 134192 [details] Excel 2013 reacts with an error to opening the attached XLSX
Repro. Win 8.1 32-bit MSO 2013 LibreOffice Version: 6.0.0.0.alpha0+ Build ID: cac5c9f6081590b0548d3116bc4cd4a2509ec576 CPU threads: 4; OS: Windows 6.29; UI render: default; TinderBox: Win-x86@42, Branch:master, Time: 2017-07-01_00:41:48 Locale: fi-FI (fi_FI); Calc: group
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
(In reply to Gabor Kelemen from comment #0) > The main problem is that the validation source with #REF! error can be saved > to both ODS and XLSX format, and in the case of XLSX, Excel 2013 considers > it an invalid file. For ODFF the #REF! is perfectly fine, see https://docs.oasis-open.org/office/OpenDocument/v1.3/cs01/part4-formula/OpenDocument-v1.3-cs01-part4-formula.html#References What does Excel save instead for an invalid reference?
(In reply to Eike Rathke from comment #7) > (In reply to Gabor Kelemen from comment #0) > > The main problem is that the validation source with #REF! error can be saved > > to both ODS and XLSX format, and in the case of XLSX, Excel 2013 considers > > it an invalid file. > > For ODFF the #REF! is perfectly fine, see > https://docs.oasis-open.org/office/OpenDocument/v1.3/cs01/part4-formula/ > OpenDocument-v1.3-cs01-part4-formula.html#References > > What does Excel save instead for an invalid reference? My Excel 2013 writes this to xl/worksheets/sheet1.xml when a cell with validation is copied to a new file: <x14:dataValidation type="list" allowBlank="1" showInputMessage="1" showErrorMessage="1"><x14:formula1><xm:f>[1]Munka2!#REF!</xm:f></x14:formula1><xm:sqref>A1</xm:sqref></x14:dataValidation> This also happens to be invalid according to Excel 2013 :). Before saving, the GUI shows the validation condition as: ='[broken-reference-orig.xlsx]Munka2'!#HIV! While Calc 7.0RC1 writes this: <dataValidation allowBlank="true" operator="between" showDropDown="false" showErrorMessage="true" showInputMessage="true" sqref="A1" type="list"><formula1>#HIV!!$C$2:$C$4</formula1><formula2>0</formula2></dataValidation> (#HIV! being Hungarian for #REF!)
Created attachment 162951 [details] Copied cell validation saved by Excel 2013
Excel 2016 xl/worksheets/sheet1.xml looks like this when a cell with validation is copied to a new file <x14:dataValidation type="list" operator="equal" allowBlank="1" showErrorMessage="1" xr:uid="{A8E4395C-A788-4CEA-9E70-BD38B4629442}"><x14:formula1><xm:f>'[validation-copypaste.xlsx]Sheet1'!#REF!</xm:f></x14:formula1><xm:sqref>A2</xm:sqref></x14:dataValidation></x14:dataValidations>
Created attachment 162969 [details] Copied cell validation saved by Excel 2016
Seeing that in the ODF case table:condition="of:cell-content-is-in-list([$#REF!.$A$1:.$A$3])" is written that's also wrong, it should be [#REF!] instead, i.e. not split into particles anymore. I think we could write a plain #REF! also in the OOXML case, which is what is written also for other reference errors. (In reply to NISZ LibreOffice Team from comment #8) > (#HIV! being Hungarian for #REF!) Really? The translated error keyword is written? Geez.. that's even worse.
It's getting even worse.. if the original validity (on Sheet2 of a *yet unsaved* document) was Sheet1.A1 or a formula like OFFSET(Sheet1.A2;-1;0) (note relative sheet reference) and copied to new document's Sheet1 it correctly displays #REF!.A1 or OFFSET(#REF!.A2;-1;0) but saved to .xlsx is Sheet1!A1 or OFFSET(Sheet1!A2,-1,0) resulting in a valid but wrong reference when reloading. Saved to .ods is the correct [#REF!] or OFFSET([#REF!];-1;0) Funny enough, if in the original bug doc on Sheet2 column A is deleted the validity displays as $Sheet2.$#REF!$1:$#REF!$3 and saving to .xlsx writes an expected <formula1>#REF!</formula1>, so something is already producing the correct string but ignores an invalid sheet reference.
A hint: The missing handling and erroneous use of native UI error string (Hungarian #HIV!) instead of #REF! are in sc/source/core/tool/compiler.cxx struct ConventionXL_OOX function makeRefStr() and the ConventionXL_A1::makeRefStr() it is calling and thereunder. Caveat, the same methods are used for the Excel A1 native UI formula syntax notation (hence XL_A1).
Serge Krot committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a3b4831208da615789bd1e2d5660dd130807f504 tdf#108673 XLSX: Don't export invalid sheet references in cell validation It will be available in 7.1.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.
Serge Krot committed a patch related to this issue. It has been pushed to "libreoffice-7-0": https://git.libreoffice.org/core/commit/03f601d10c8fe8772dcb8542e1d44f2d2e87fbb4 tdf#108673 XLSX: Don't export invalid sheet references in cell validation It will be available in 7.0.2. 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.
Serge Krot committed a patch related to this issue. It has been pushed to "libreoffice-6-4": https://git.libreoffice.org/core/commit/bd416f4a44acfea54afc377b9880863fd969dbe1 tdf#108673 XLSX: Don't export invalid sheet references in cell validation It will be available in 6.4.7. 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.