win32com:excel 插入图片,并设置图片大小
a = sheet.Range("A2")
pic = sheet.Pictures().Insert(pngfile)
r = pic.ShapeRange
h = 450
scale = r.Width / r.Height # 等比例缩放尺度。
w = int(h * scale) # 获得相应等比例的图像宽度。
r.LockAspectRatio = False
r.Left = a.Left + 0 # 设置图片位置,相对于单元格 a 的 位置
r.Top = a.Top + 5
r.Width, r.Height = w, h # 设置粘贴的图片宽度