Closed znakeeye closed 2 years ago
It might be problematic for the consumer of the library to calculate the image height. Since
libxlsxwriter
is able to read the height of many types of images, why not allow for this feature natively?
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_images
property 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.
Consider your example here.
As shown below, you need to call
worksheet_set_margins
to make the header image fit. It would be nice if theworksheet_set_header_opt
could do this automatically. E.g. through a newauto_fit_images
setting.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
libxlsxwriter
is able to read the height of many types of images, why not allow for this feature natively?