New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Images don't work #51
Comments
Thanks for the report! I’m not using Windows so it’s hard for me to investigate this further. Which version of axlsx are you using? |
axlsx-2.0.1 |
Just ran it on my Windows machine and can confirm. @palmaste Did you use a ruby windows installer, or another method, to install ruby? |
Note: Switching from axlsx to caxlsx changes from rubyzip-1.0.0 to rubyzip-2.3.0. |
@straydogstudio Yes, I used rubyinstaller-devkit-2.6.6-1-x64.exe |
Just a wild guess: Could it be that we are reading / writing the image file somewhere without the “binary” flag? IIRC this doesn’t hurt on Unix-based systems, but may lead to corrupt files on Windows. |
@straydogstudio Thank you. Currently I continue to use axlsx, but the problem is the dependency on the old version of rubyzip which prevents updating other gems. |
@palmaste There's a version 2.0.2 of caxlsx which is still based on the v2-branch of axlsx, but contains an updated Rubyzip dependency: https://rubygems.org/gems/caxlsx/versions/2.0.2 Maybe you could use this as a workaroud before upgrading to caxlsx 3. |
@noniq Thank you. It works! It seems to depend on rubyzip-1.3.0. Anyway it'is a step forward. |
Has this issue been fixed? I recently found this problem on my work Windows pc. But tried the script in a Ubuntu server and it worked |
@dicamarques14 @noniq @palmaste I have isolated the problem to an IO call. I've tried to reproduce the issue outside of Rails but haven't completed that part. I will try to get to it soon. Here is the location it occurs in caxlsx: https://github.com/caxlsx/caxlsx/blob/master/lib/axlsx/package.rb#L165-L168 |
Maybe changing line 167 like this fixes the problem? zip.write IO.read(part[:path], mode: "rb") |
Looks like that did it. I think you mentioned that before Stefan. I'm sorry I missed it. I'll push out a new release. Do we have anything else that should be included? |
I think there have been two or three small fixes since the last release, but they are already merged and mentioned in the Changelog (section “Unreleased”). Nothing else on my radar, currently. Let's do a release! 🚀 |
Sounds good. Once testing passes I'll bump the version number and release. |
3.0.2 released. @palmaste Please test as you have time. |
@straydogstudio It works! Thank you all. |
I'm using Ruby 2.6.6-1-x64 on Windows and caxlsx 3.0.1.
The images do not appear on the worksheet.
It seems that the images are only partially copied in subfolder xl/media of xlsx file.
If I simply swap to the axlsx library, everything works again.
Example:
simple.xlsx
The text was updated successfully, but these errors were encountered: