Picture

class Picture(impl=None)

The picture object is a member of the pictures collection:

>>> import xlwings as xw
>>> sht = xw.books['Book1'].sheets[0]
>>> sht.pictures[0]  # or sht.charts['PictureName']
<Picture 'Picture 1' in <Sheet [Book1]Sheet1>>

在 0.9.0 版本发生变更.

property api: Any

Returns the native object (pywin32 or appscript obj) of the engine being used.

在 0.9.0 版本加入.

delete()

删除图片。

在 0.5.0 版本加入.

property height: float

获得或者设置图片的高度,单位是 point

在 0.5.0 版本加入.

property left: float

获得或者设置图片的水平位置,单位是 point

在 0.5.0 版本加入.

property lock_aspect_ratio: bool

True will keep the original proportion, False will allow you to change height and width independently of each other (read/write).

在 0.24.0 版本加入.

property name: str

获得或者设置图片的名字。

在 0.5.0 版本加入.

property parent: Sheet

返回图片所属的对象。

在 0.9.0 版本加入.

property top: float

获得或者设置图片的垂直位置,单位是 point

在 0.5.0 版本加入.

update(image, format=None, export_options=None)

用新的图片替换原有的图片,继承原来图片的属性。

参数:
  • image (str | PathLike[str] | Any) -- 是文件路径名或者是Matplotlib图形对象。

  • format (str | None) -- See under Pictures.add()

  • export_options (dict[str, Any] | None) -- See under Pictures.add()

在 0.5.0 版本加入.

property width: float

获得或者设置图片的宽度,单位是 point

在 0.5.0 版本加入.