Bug 166712 - FILESAVE XLSX Invalid connections.xml saved with empty dbPr and olapPr elements
Summary: FILESAVE XLSX Invalid connections.xml saved with empty dbPr and olapPr elements
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
25.2.0.3 release
Hardware: All All
: medium normal
Assignee: Aron Budea
URL:
Whiteboard: target:25.8.0 target:25.2.5
Keywords: bibisected, bisected, implementationError
Depends on:
Blocks: XLSX-Corrupted Calc-External-Datalink
  Show dependency treegraph
 
Reported: 2025-05-24 21:07 UTC by Aron Budea
Modified: 2025-05-26 07:55 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
moz1540281-1.xlsx (14.59 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2025-05-24 21:07 UTC, Aron Budea
Details
forum-en-5043.xlsx (6.88 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2025-05-24 21:10 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2025-05-24 21:07:49 UTC
Created attachment 200945 [details]
moz1540281-1.xlsx

The attached file is a copy of the following Mozilla Bugzilla attachment, moz1540281-1.xlsx:
https://bugzilla.mozilla.org/attachment.cgi?id=9054708
From: https://bugzilla.mozilla.org/show_bug.cgi?id=1540281

Open and save it back to XLSX, then try opening it in Excel.

=>Excel fails to open the file cleanly. When attempting repairs, it gives:
"Removed Part: /xl/connections.xml part with XML error.  (Data connection) Load error. Line 2, column 551."

The issue is because of the following empty elements in xl/connections.xml:
<dbPr/>
<olapPr/>

The file can be opened fine if these elements are removed.

This started with the following commit in 25.2:
https://git.libreoffice.org/core/commit/045ebdb369ab21a3be7a32dc1c85ad2243eb9129
https://cgit.freedesktop.org/libreoffice/core/commit/?id=045ebdb369ab21a3be7a32dc1c85ad2243eb9129
author		Bayram Çiçek <bayram.cicek@collabora.com>	Sat Mar 02 16:41:54 2024 +0300
committer	Caolán McNamara <caolan.mcnamara@collabora.com>	Tue Jul 09 10:17:16 2024 +0200

"tdf#158857: [Power Query] export connections.xml"

Other files that started failing from the same commit:
- attachment 118297 [details] from bug 93819,
- attachment 114686 [details] from bug 90511,
- attachment 118741 [details] from bug 88849,
- attachment 98383 [details] from bug 78229,
- attachment 152467 [details] from bug 126047,
- attachment 134704 [details] from bug 109183.
Comment 1 Aron Budea 2025-05-24 21:10:56 UTC
Created attachment 200946 [details]
forum-en-5043.xlsx

This file is a different case, technically not the same issue, even though it started from the same commit. The file is from a 3rd party generator, and while Excel can open the original, the file structure is incomplete:
- [Content_Types].xml contains reference to xl/connections.xml
- xl/_rels/workbook.xml.rels contains reference to connections.xml
- there is no actual xl/connections.xml in the archive

During export a skeleton xl/connections.xml is added, and Excel fails to open the result. In this case, omitting any reference to the non-existent file makes it so it can be opened in Excel.

It's not worth a separate bug report, so I'm just noting the issue here.
Comment 2 Commit Notification 2025-05-26 04:53:52 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c55d85888752f128a7d414963c9d7b8787d1fc48

tdf#166712 sc: don't export empty dbPr/olapPr elements to connections.xml

It will be available in 25.8.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.
Comment 3 Commit Notification 2025-05-26 07:55:21 UTC
Aron Budea committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/4281933537005ffb2de142be2788fffe372c16d3

tdf#166712 sc: don't export empty dbPr/olapPr elements to connections.xml

It will be available in 25.2.5.

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.