Skip to content
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

Fit image to cell #85

Closed
iamabhiee opened this issue Jan 4, 2017 · 1 comment
Closed

Fit image to cell #85

iamabhiee opened this issue Jan 4, 2017 · 1 comment
Assignees
Labels

Comments

@iamabhiee
Copy link

Library seems really good, I am trying to fit image to cell but I couldn't find a way, whats best way to do the same?

@jmcnamara jmcnamara self-assigned this Jan 4, 2017
@jmcnamara
Copy link
Owner

Hi Abhishek,

The best, and only, way is to scale the image with the worksheet_insert_image_opt() function to fit into a standard Excel cell size of 20x64 pixels:

lxw_image_options options = {.x_offset = 30,  .y_offset = 10,
                             .x_scale  = 0.5, .y_scale  = 0.5};
worksheet_insert_image_opt(worksheet, 2, 1, "logo.png", &options);

See the docs for worksheet_insert_image_opt(): http://libxlsxwriter.github.io/worksheet_8h.html#a0b05e75e2c2a5c3452374714cdb2b79b

John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants