Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当直接写入 xlsx 文件时, insert_image 会按预期工作。但是当写入 BytesIO 对象时它不起作用,图像根本不会出现。
好的,我必须实际指定 image_data 参数才能使用字节流工作。
img = 'img.png' image_file = open(img, 'rb') image_data = io.BytesIO(image_file.read()) image_file.close() ws_dashboard.insert_image('A1',img, {'image_data': image_data, 'x_scale': 0.5, 'y_scale': 0.5})