墨烟溪
2020-08-03 09:01
图片只能用bmp图片吗
insert_bitmap()
仅适用于bmp格式,xlsxwriter不仅支持bmp,而且还支持jpeg和png文件,通过worksheet.insert_image
Traceback (most recent call last):
File "E:/Embedded programming/Python/excel/writeExcel.py", line 19, in <module>
wsimage.insert_bitmap("无标题.jpg",0,0)
File "D:\Program Files\Python387\lib\site-packages\xlwt\Worksheet.py", line 1122, in insert_bitmap
bmp = Bitmap.ImDataBmpRecord(filename)
File "D:\Program Files\Python387\lib\site-packages\xlwt\Bitmap.py", line 273, in __init__
self.width, self.height, self.size, data = _process_bitmap(filename)
File "D:\Program Files\Python387\lib\site-packages\xlwt\Bitmap.py", line 198, in _process_bitmap
return _process_bitmap_data(data)
File "D:\Program Files\Python387\lib\site-packages\xlwt\Bitmap.py", line 206, in _process_bitmap_data
raise Exception("bitmap doesn't appear to to be a valid bitmap image.")
Exception: bitmap doesn't appear to to be a valid bitmap image.
我添加png和JPG格式的,显示这个报错
Python办公自动化
48656 学习 · 163 问题
相似问题