Bug 120689 - FILESAVE Roundtripped XLSM opens with recovery in Excel
Summary: FILESAVE Roundtripped XLSM opens with recovery in Excel
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:6.2.0 target:6.1.4
Keywords: filter:xlsx
Depends on:
Blocks: XLSX-Corrupted Macro-VBA
  Show dependency treegraph
 
Reported: 2018-10-18 23:04 UTC by Aron Budea
Modified: 2018-11-05 05:34 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample XLSM (14.04 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2018-10-18 23:04 UTC, Aron Budea
Details
Roundtripped XLSM (corrupted) (6.72 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2018-10-18 23:06 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2018-10-18 23:04:35 UTC
Created attachment 145818 [details]
Sample XLSM

The attached Excel XLSM contains a simple function called from a couple of fields.
Save it in Calc, and open it in Excel.

=> Excel opens the file with recovery, after which it claims named range from /xl/workbook.xml has been removed.

It appears Calc saves this in /xl/workbook.xml that wasn't in the original, and is removed with the recovery:

<definedNames>
  <definedName function="true" hidden="false" name="TEST" vbProcedure="true"/>
</definedNames>

After removing these manually, and rezipping the XLSM, the file opens fine in Excel.

Observed using LO 6.2.0.0.alpha0+ (2018-10-09, 425af6845ebe066c950b0b63f50563e067485f3e) / Windows 7.
Comment 1 Aron Budea 2018-10-18 23:06:20 UTC
Created attachment 145819 [details]
Roundtripped XLSM (corrupted)
Comment 2 raal 2018-10-19 06:07:48 UTC
Confirm. Version: 6.2.0.0.alpha0+
Build ID: 425af6845ebe066c950b0b63f50563e067485f3e
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win;
Comment 3 Aron Budea 2018-10-21 13:21:05 UTC
The below commit added a noteworthy branching in sc/source/filter/excel/xeformula.cxx here:
https://opengrok.libreoffice.org/xref/core/sc/source/filter/excel/xeformula.cxx#1647

Perhaps the same should be replicated for the preceding "case ocMacro:" path. Eike, would that be a reasonable fix in your opinion? I tested the change, and it works fine in this case, but I don't know if there are further implications to worry about.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=1162738c6fbd8505ffa27b28118318cc522a5368
author		Eike Rathke <erack@redhat.com>	2013-01-24 23:17:00 +0100
committer	Eike Rathke <erack@redhat.com>	2013-01-25 00:23:36 +0100

resolved fdo#59819 write correct OOXML function name mapping
Comment 4 Eike Rathke 2018-10-22 19:03:24 UTC
A similar change looks ok to me.
Comment 5 Commit Notification 2018-10-23 13:05:32 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4df55ffee791b9fcb4b2f5e6c64ad15b34316faf

Resolves: tdf#120689 omit <definedName> for ocMacro in OOXML

It will be available in 6.2.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 Eike Rathke 2018-10-23 13:09:17 UTC
Pending review https://gerrit.libreoffice.org/62235 for 6-1
Comment 7 Commit Notification 2018-10-24 08:34:36 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d6f563b37d8a694c6c1d4c9ef3ba746c7f019517&h=libreoffice-6-1

Resolves: tdf#120689 omit <definedName> for ocMacro in OOXML

It will be available in 6.1.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.
Comment 8 Aron Budea 2018-11-05 05:34:22 UTC
Verified with LO 6.2.0.0.alpha1+ (2018-11-01, e33424dd887cb1a11a3dba2513ef0f4bf93a6dbe) / Windows 7.

Thanks for making the fix, Eike!