Bug 143958 - FILEOPEN: Can't open third-party (Kingdee ERP) generated XLSX file
Summary: FILEOPEN: Can't open third-party (Kingdee ERP) generated XLSX file
Status: RESOLVED DUPLICATE of bug 82984
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:xlsx
Depends on:
Blocks: XLSX-External-Generators
  Show dependency treegraph
 
Reported: 2021-08-19 18:18 UTC by Liaison to zh-CN User Community
Modified: 2021-11-04 05:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file provided by the original reporter (4.79 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2021-08-19 18:18 UTC, Liaison to zh-CN User Community
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Liaison to zh-CN User Community 2021-08-19 18:18:19 UTC
Created attachment 174428 [details]
Sample file provided by the original reporter

This is a bug report translated and forwarded from a Chinese LibreOffice user forum.  The original report (in Chinese) is:
https://bbs.libreofficechina.org/thread-2881-1-1.html

Description:

The XLSX format files exported from 金蝶 (Kingdee) ERP system's web tools can't be opened by LibreOffice, while MS Office and Kingsoft WPS open them correctly.  Sample file attached.

From the analysis in the original report, it seems the culprit is in the XLSX file's docProps/custom.xml file.  It starts with (after the mandatory <?xml version="1.0"?> line):
<q1:Properties xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:q1="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties">
If one changes that line to
<q1:Properties xmlns:q1="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" ...
i.e., move the "xmlns:q1" part to the first place, the file can be opened by LibreOffice.

I don't know what the OOXML standard says, but since MS Office accepts such a file, unless it's strictly forbidden by the standard, having LO allow such a small deviation from the proper order should be beneficial to users.

Additional information:

I can reproduce that neither LO 7.0.6 or 7.2.0 RC3 can open the attached sample file:

Version: 7.0.6.2 (x64)
Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: zh-CN (zh_CN); UI: en-US
Calc: threaded

Version: 7.2.0.3 (x64) / LibreOffice Community
Build ID: 2a7ea282da28d665a7dc086360567b4aea27bf08
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded

7.2.0 RC3 first claims the file may be damaged and offers to repair it, but when told "yes", can not repair and returns "General input/output error".  7.0.6 just gives "General input/output error" directly.

Another user (not the original reporter) can reproduce that the sample file opens in MS Office 2016 for Windows and MS Office 365 for Mac without problems.
Comment 1 Regina Henschel 2021-08-19 21:15:06 UTC
I confirm the problem. I have tested with Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: d51c383b0204057e1b341db2d38b6d2dbb0c84e8
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: threaded

The validator in "Open XML SDK 2.5 Productivity Tool for Microsoft Office" reports no errors for this file.
Comment 2 Timur 2021-08-20 07:44:42 UTC
There are multiple bugs for generated files. 
This one opens if simply unzipped and rezipped. 
Let's keep with another similar case.

*** This bug has been marked as a duplicate of bug 76115 ***
Comment 3 Liaison to zh-CN User Community 2021-08-20 14:28:58 UTC
(In reply to Timur from comment #2) 
> This one opens if simply unzipped and rezipped. 
Thanks Timur.  I can confirm that simple unzipping and rezipping generates a file that opens fine in LO, the docProps/custom.xml thing turns out to be just a red herring.

I've posted this information back to the original Chinese thread.  Hope the interested parties can find out the root cause of this issue.
Comment 4 Kevin Suo 2021-11-04 05:41:04 UTC
I debugged and find that the test file reported in bug 143958 raised 
"ZipException: PK64 zip file entry /home/suokunlong/lo/source/core/package/source/zipapi/ZipFile.cxx:950"

In ZipPackage::initialize
https://opengrok.libreoffice.org/xref/core/package/source/zippackage/ZipPackage.cxx?r=d0a8d4a9#779

Thus this bug should not be marked as a duplicate bug 82984 instead.

*** This bug has been marked as a duplicate of bug 82984 ***