Bug 88137

Summary: Spaces before cell values are not preserved when save as XLSX and reopen with MSO
Product: LibreOffice Reporter: Kevin Suo <suokunlong>
Component: CalcAssignee: Markus Mohrhard <markus.mohrhard>
Status: RESOLVED FIXED    
Severity: critical CC: h3734236, raal
Priority: medium    
Version: 4.4.0.1 rc   
Hardware: All   
OS: All   
Whiteboard: target:5.1.0
Crash report or crash signature: Regression By:
Attachments: test file created using LibreOffice 4.4.0.1
test file created using MSO 2010

Description Kevin Suo 2015-01-07 07:24:33 UTC
Steps to reproduce:
1. Type in "   abc" in A1 (there are three spaces before the letters).
2. Save as xlsx;
3. Reopen with MSO.

--> It shows "abc" when open with MSO, the spaces are not preserved.

4. Reopen the xlsx with LibreOffice
--> It shows "   abc" in A1 as expected.

More info:
Unzip the xlsx file, you will find in \xl\sharedStrings.xml:
<t>   abc</t>

When you create a same xlsx file using MSO 2010, you will find in \xl\sharedStrings.xml:
<t xml:space="preserve">   abc</t>

Aparently the attibute xml:space="preserve" matters.

Version: 4.4.0.1
Build ID: 1ba9640ddd424f1f535c75bf2b86703770b8cf6f
Locale: zh_CN
Win 7 X86
Comment 1 Kevin Suo 2015-01-07 07:26:05 UTC
Created attachment 111885 [details]
test file created using LibreOffice 4.4.0.1
Comment 2 Kevin Suo 2015-01-07 07:27:49 UTC
Created attachment 111886 [details]
test file created using MSO 2010
Comment 3 raal 2015-01-07 22:05:17 UTC
I can confirm with Version: 4.5.0.0.alpha0+
Build ID: 7f476fea47f06a7f8cc961dd4f6595a524346fa5
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-12-27_23:36:28
Comment 4 Markus Mohrhard 2015-04-18 01:05:32 UTC
So to make things really funny. This is a MSO bug and not a LibreOffice bug. Not laughing yet, there is also a nice bug around that in the OOXML spec. They mention the attribute in the spec but forgot to include it in the xsd schema so the validator is flagging that attribute.

We are going to include that attribute as soon as I have an idea how to fix our validator.
Comment 5 Commit Notification 2015-07-06 16:00:10 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3004221e47918eb08cfa98ba43a23a0b25412cd5

preserve whitespaces here, tdf#88137, tdf#89254

It will be available in 5.1.0.

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 2015-07-19 20:32:52 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

add unit test for tdf#88137, tdf#89254

It will be available in 5.1.0.

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 7 Commit Notification 2015-11-05 17:30:27 UTC
Katarina Behrens committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=825f8422bb2cce52bd3095a63de14b34b32ae37c

tdf#88137, tdf#89254: Preserve whitespace also in formatted strings

It will be available in 5.1.0.

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.