mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #284] worksheet_set_row_opt scales inserted image vertically? #227
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#227
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 @znakeeye on GitHub (Apr 16, 2020).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/284
Originally assigned to: @jmcnamara on GitHub.
When inserting an image (
constant_memory = true) it is somehow scaled by the outline row height. Is this expected behavior?The 349x70 image

Expected:

Actual:

@znakeeye commented on GitHub (Apr 16, 2020):
Shouldn't
lxw_worksheet_find_row()consideroptimize_row? I.e.:@znakeeye commented on GitHub (Apr 16, 2020):
I can confirm that the above seems to fix this problem. Can you please verify that this patch is valid and consider pushing it to master?
@znakeeye commented on GitHub (Apr 17, 2020):
Update: My suggested fix does not work if adding text on any other row. E.g. before closing the workbook:
Obviously, the "optimize_row" is updated to row 1 before the image is written to row 0. This is bad :(
Ideas?
@jmcnamara commented on GitHub (Apr 17, 2020):
I haven't had a chance to look at this yet. Just to be clear, does this happen when you set
.constant_memory = LXW_FALSEin theworkbook_new_opt()constructor?@znakeeye commented on GitHub (Apr 17, 2020):
It does not happen when I set
.constant_memory = LXW_FALSE. I investigated this a bit further, and my latest idea is the following:Thus, no fiddling with the height when using
constant_memory. Makes sense?@jmcnamara commented on GitHub (Apr 17, 2020):
Okay. In that case it is a bug.
I don't know. I'll have to write some test cases and then fix it. I'll look into it.
@znakeeye commented on GitHub (Apr 20, 2020):
Please, also have a look at this other issue. There seems to be a generic problem with the first outline when
symbols_belowis false.@znakeeye commented on GitHub (Jan 25, 2021):
No news regarding this bug?
@jmcnamara commented on GitHub (Jan 25, 2021):
As far as I remember a fix for this turned out to be too complicated. So, realistically, it is probably a "won't fix". I fill probably document that image scaling with modified row heights doesn't work in "constant_memory" mode.
@znakeeye commented on GitHub (Jan 25, 2021):
Too bad :/
Please recall my suggested fix:
I've been using this patch for a while now. It seems to work quite well. Not sure when and why it would break. Perhaps we could add some
#define ENABLE_SHAKY_IMAGE_SCALING_PATCHto allow for this "weak" patch?@jmcnamara commented on GitHub (Jan 25, 2021):
Unfortunately, some of the test cases fail if that patch is applied.
I'll keep the issue open and see if there is anything that can be done.
@jmcnamara commented on GitHub (Mar 23, 2021):
I don't think this is easily fixed, and currently it isn't worth the effort since it seems to be a bit of an edge case. So for now I'm just going to document it and leave it as a "won't fix". Sorry.
@znakeeye commented on GitHub (Jun 29, 2021):
Too bad. Having a logo at the top of generated reports is not uncommon. So I would expect this bug to re-appear.
If I get time, I could try to find a better fix. Or perhaps, the existing tests are not bullet-proof in this case?
@jmcnamara commented on GitHub (Jun 29, 2021):
Some users use header images for this (which is why I added that feature). See: https://libxlsxwriter.github.io/headers_footers_8c-example.html
Also this only affects
constant_memorymode which is primarily meant for large files or raw data conversions so hopefully it won't affect too many people.The test cases are based on files created by Excel so they need to remain the same. The code can change if the tests still pass.
@Michoels commented on GitHub (May 30, 2024):
Just encountered this behavior and it took me a few hours of pulling my hair out before I found this thread 😥
Can you add an additional note to the
READMEhere specifying thatconstant_memorymode can break image scaling in certain situations?