python xlwings Pictures

python xlwings Pictures

import xlwings as xw

app=xw.App()
wb=app.books.open(r'C:\Users\Administrator\Desktop\2.xlsx')
sht=wb.sheets[0]

'''
add(image, link_to_file=False, save_with_document=True, left=0, top=0, 
    width=None, height=None, name=None, update=False, scale=1)
image 文件地址
left 距离左边距离
top 距离上边距离
width 宽
height 高
name 图片名字 默认‘Picture 1’
update (bool, default False) – Replace an existing picture with the same name. Requires name to be set
'''
sht.pictures.add(r'C:\Users\Administrator\Desktop\1.jpg',link_to_file=True,left=60,top=60)
sht.pictures.add(r'C:\Users\Administrator\Desktop\2.jpeg')
print(sht.pictures[0].height)
print(sht.pictures[0].left)
print(sht.range('a1').width)
# sht.pictures[0].left=sht.range('a1').width
# sht.pictures[0].width=sht.range('a1').width
# sht.pictures[0].top=0
# sht.pictures[0].height=sht.range('a1').height
# print(sht.pictures)
# sht.pictures[1].left=sht.range('a1').width*2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值