mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #373] Automatic print margins from header image #298
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#298
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 (May 17, 2022).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/373
Originally assigned to: @jmcnamara on GitHub.
Consider your example here.
As shown below, you need to call
worksheet_set_marginsto make the header image fit. It would be nice if theworksheet_set_header_optcould do this automatically. E.g. through a newauto_fit_imagessetting.The original sample
Auto-sizing of the print margins
With this new feature, the library would perform the following when a header image is added:
And then, the sample above simply becomes:
Motivation
It might be problematic for the consumer of the library to calculate the image height. Since
libxlsxwriteris able to read the height of many types of images, why not allow for this feature natively?@jmcnamara commented on GitHub (May 17, 2022):
Thanks for the suggestion. Overall I think this is outside the scope of libxlsxwriter and falls into to the category of things that the user can do themselves without the help of the library.
In general people use the header image option to set a company logo, or similar, and that is generally a one-off activity. So for me, it is best to leave specifying the top margin to the end user, since they are likely to only have to figure that once per logo (as you would have to do with Excel). If there was a
auto_fit_imagesproperty of Excel file format then I would be happy to implement that but any heuristic calculation by the library might not give the end user what they expect. For example the space required in the margin doesn't just depend on the image height but also on the DPI.So for me this is a pass, but thanks once more for the suggestion.