Bug 75168 - FILESAVE conditional formating in xlsx format corrupts the file
Summary: FILESAVE conditional formating in xlsx format corrupts the file
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: Other All
: medium major
Assignee: Markus Mohrhard
URL:
Whiteboard: target:4.3.0 target:4.2.5
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-18 19:03 UTC by tajuma
Modified: 2014-05-05 20:06 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tajuma 2014-02-18 19:03:42 UTC
Saving conditional formating in xlsx format with "formula is" condition does not properly escape xml-characters in the formula.

Steps to reproduce:

1. Create new empty spreadsheet
2. Cursor in A1, open conditional formating dialog (Format / Conditional Formatting / Conditional... )
3. In the dialog, select "Formula is" and enter "A1 <> 0"
4. Press OK to dismiss the dialog
5. Save file in xlsx format

Expected behaviour:

File can be opened with Excel.

Current behaviour:

Inside the xlsx file xl/worksheets/sheet1.xml is not valid a xml file as it contains 

...
<conditionalFormatting sqref="A1">
  <cfRule type="expression" priority="2" aboveAverage="0" equalAverage="0" bottom="0" percent="0" rank="0" text="" dxfId="0">
    <formula>A1<>0</formula>
  </cfRule>
</conditionalFormatting>
...

i.e. the formula tag contains unescaped < and > chars.
Comment 1 m.a.riosv 2014-02-19 00:45:20 UTC
Hi tajuma, thanks for reporting.

Reproducible, lost the condition in xlsx.
Version: 4.2.0.4 Build ID: 05dceb5d363845f2cf968344d7adab8dcfb2ba71
Version: 4.2.1.1 Build ID: d7dbbd7842e6a58b0f521599204e827654e1fb8b
Version: 4.3.0.0.alpha0+ Build ID: ecf22894f522374cbdb8196d3bdef88e2fba7af9
   TinderBox: Win-x86@39, Branch:master, Time: 2014-02-15_01:01:17
Version: 4.1.6.0.0+ Build ID: 2e2040401d99fe116b65b9661c3d4755091a660
Version 4.0.6.2 (Build ID: 2e2573268451a50806fcd60ae2d9fe01dd0ce24)
Versión 3.6.7.2 (ID de compilación: e183d5b)
Version 3.5.7.2 with old conditional format.
Comment 2 reddish 2014-03-26 13:12:55 UTC
I have found that any conditional formatting of a cell produces excel to report a corrupted file.

Tested: 
Libreoffcie 4.2.2.1 (win 7)
MS office 2010

Reddish
Comment 3 Markus Mohrhard 2014-04-29 19:17:08 UTC
If there are more problems than the one mentioned in the first post please open a new bug report and put me into CC.
Comment 4 Commit Notification 2014-05-01 00:35:50 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3629fac93ee96a3778bb9a7a63150b35c5d9bc3c

escape conditional formatting formulas during xlsx export, fdo#75168



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2014-05-01 00:36:05 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3cca2dca62b19242a5b421f938443eabcd24b671

add test for fdo#75168



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2014-05-05 20:06:01 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8a14eb18ffc34ab6d7afb8ab0abeb878b3ad2b11&h=libreoffice-4-2

escape conditional formatting formulas during xlsx export, fdo#75168


It will be available in LibreOffice 4.2.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.