Openpyxl调整两个单元格之间的图像 [英] Openpyxl adjust image between two cells
本文介绍了Openpyxl调整两个单元格之间的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用openpyxl调整两个单元格之间的图像.我的问题是
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?
我尝试使用
height = sum([worksheet.row_dimensions[start_row+i].height for i in range(img_cols)])
,然后将其设置为
from openpyxl.drawing.image import Image
Image(image_filename, size=[width,height])
但这也不起作用
推荐答案
您将可以在openpyxl 2.5中执行此操作,但是将创建并管理您自己的锚点.
You will be able to do this in openpyxl 2.5 but will have create and manage your own anchor.
这篇关于Openpyxl调整两个单元格之间的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文