mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #225] Inserting many images creates oversized and broken xlsx file #181
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#181
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @michalw69 on GitHub (May 10, 2019).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/225
Originally assigned to: @jmcnamara on GitHub.
I've included testcase that demonstrate the problem stated in the title
main.cpp.txt
Each image is saved as a separate object. It seems the file names in xlsx media folder overlap (there are multiple image0.prn, image1.png etc. files) and cause Excel to complain.
This is also inefficient both in time and space - the original 46MB file after repair shrinked to ca. 3MB.
This could be solved by introducing bitmap objects like this
{ lxw_image *image = workbook_add_image(...);
worksheet_insert_image(worksheet, row, col, image); }
Alternatively but less efficiently image cache could be implemented within worksheet_insert_image_buffer.
@jmcnamara commented on GitHub (May 10, 2019):
Adding the sample program:
@jmcnamara commented on GitHub (May 10, 2019):
Thanks, that is a bug. I'll look into fixing it soon.
There are plans to do that. Probably in the short term.
@jmcnamara commented on GitHub (Jun 11, 2019):
I've fixed the issue that was causing broken files. The fix is on master.
Handling duplicate images is a feature request which will be addressed soon. In the meantime add a +1 to the similar Python feature request and you will be notified when it is completed. https://github.com/jmcnamara/XlsxWriter/issues/615
The C version will follow soon after.
@jmcnamara commented on GitHub (Jun 12, 2019):
I had to add some additional fixes for some other edge cases. Now on master.
@michalw69 commented on GitHub (Jun 27, 2019):
Thanks John, the correction works.
My colleague reported only minor problem with building the library with msvc because of including <strings.h> which is unavailable and not necessary.
@jmcnamara commented on GitHub (Jun 27, 2019):
That is now fixed on master.
@jmcnamara commented on GitHub (Dec 26, 2019):
Note, duplicate images are now removed by libxlsxwriter so the output files are smaller, like Excel.
The fix is on master.