Bug 95677 - Exponent must have sign when export to Excel
Summary: Exponent must have sign when export to Excel
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Laurent Balland
URL:
Whiteboard: target:5.1.0 target:5.0.4
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-08 13:12 UTC by Laurent Balland
Modified: 2016-10-25 19:19 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
ODF file without sign in exponent for a scientific number (7.99 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-11-08 13:12 UTC, Laurent Balland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Balland 2015-11-08 13:12:49 UTC
Created attachment 120387 [details]
ODF file without sign in exponent for a scientific number

Description: Scientific format may skip sign in exponent (for positive exponent) with format such as "0.00E00". This format can be save in ODF from LibO 5.0. See bug 90133. However, Excel is not able to manage such format. So export to Excel should forced format to show sign in exponent even for positive exponent with "0.00E+00".

Steps to reproduce:
1. enter a value (>= 1.0) in a cell, for instance 5
2. Format > Cells > Numbers. Change format code to 0.00E00 (without sign in exponent)
3. OK => display correctly 5.00E00 instead of 5.00E+00 with default scientific format
4. File > Save in ODF format (see attached document)
5. File > Reload => display is correctly 5.00E00 (from LibO 5.0)
6. File > Save in XLS format
7. open file with Excel 2003

Actual behavior
A warning message appears: "File Error. Some number format may be lost." and cell is formated as Standard.

Expected behavior
No warning message, cell should be formated to the nearest supported format: 0.00E+00

It is worth if you export to XLSX:
- Excel 2003 (with compatibility module) refuses to open the file
- Excel 2010 can open file with a warning about number format repaired
Comment 1 Laurent Balland 2015-11-08 13:17:50 UTC
Actually, the bug is present from origin. The difference is that before LibO 5.0 should can not do step 5 (reload of ODF document) as it was not saved in XML code, only correctly displayed.
Comment 2 Laurent Balland 2015-11-12 13:24:34 UTC
Identify function void XclExpNumFmtBuffer::WriteFormatRecord
http://opengrok.libreoffice.org/xref/core/sc/source/filter/excel/xestyle.cxx#1428

where rFormatStr should be modified
Comment 3 Eike Rathke 2015-11-12 18:21:07 UTC
No, the change should be done deeper at the number formatter level, otherwise you'd have to do the same change for the binary Excel format and Word formats.

svl/source/numbers/zformat.cxx SvNumberformat::GetMappedFormatstring() looks like the place to go.
Comment 4 Commit Notification 2015-11-23 14:29:17 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=96ff6372e15fa17211650ec6f0da13771a572a42

tdf#95677 Force sign to exponent for Excel export

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 5 Commit Notification 2015-11-23 14:41:48 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=bad71e69bae0dbfbf4bfabcd5e53e0feafd65d90&h=libreoffice-5-0

tdf#95677 Force sign to exponent for Excel export

It will be available in 5.0.4.

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.