You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using XlsxWriter with the in_memory option results in files which are not properly compressed.
The issue is caused by XlsxWriter constructing its own ZipInfo objects and using ZipFile.writestr() to write them without specifying the compression type. It's not documented, but from the Python zipfile module's source I was able to tell that in this case ZipInfo files do not inherit the ZipFile's compression and default to ZIP_STORED. As the ZipFile is instantiated with ZIP_DEFLATED I assume this is not intentional.
I've verified the problem occurs with XlsxWriter 1.1.1 (and the latest development version too) both with Python version 2.7.15 and 3.6.6.
A short script that can be used to reproduce the problem:
Using XlsxWriter with the
in_memory
option results in files which are not properly compressed.The issue is caused by XlsxWriter constructing its own
ZipInfo
objects and usingZipFile.writestr()
to write them without specifying the compression type. It's not documented, but from the Pythonzipfile
module's source I was able to tell that in this caseZipInfo
files do not inherit theZipFile
's compression and default toZIP_STORED
. As theZipFile
is instantiated withZIP_DEFLATED
I assume this is not intentional.I've verified the problem occurs with XlsxWriter 1.1.1 (and the latest development version too) both with Python version 2.7.15 and 3.6.6.
A short script that can be used to reproduce the problem:
I've first noticed the size differences when comparing generated files with ones created by Excel. But it can be verified with the
zipinfo
command:The expected compression level is greater than 0%, also the files are listed with
STORE
compression.The text was updated successfully, but these errors were encountered: