Openpyxl adjust image between two cells

假如想象 提交于 2020-01-25 00:24:47

问题


I'm trying to adjust image between two cells using openpyxl. My problem is that

worksheet.add_image(image, position)

method only accepts top-left position of image.

Is there any way how to scale my image between two (top-left, bottom-right) cells?

I tried to compute dimensions using

height = sum([worksheet.row_dimensions[start_row+i].height for i in range(img_cols)])

and then setting it as

from openpyxl.drawing.image import Image
Image(image_filename, size=[width,height])

but that doesn't work either


回答1:


You will be able to do this in openpyxl 2.5 but will have create and manage your own anchor.



来源:https://stackoverflow.com/questions/43063292/openpyxl-adjust-image-between-two-cells

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!