英文:
PNG image corrupted when saved
问题
我有一段Python代码,用于迭代Excel对象并可以找到每个图表,并将其保存为png。但是,当我运行脚本并保存图像后,当我尝试查看它们时,它们是损坏的。
我尝试将它们保存为png或jpeg。我还需要使用这种方法,不能使用原始数据创建图表。
英文:
I have code that iterates through Excel objects in Python and can find each graph and saves it as a png. however, when I run the script and the images get saved, when I try and Then I view they are corrupted.
I try and save them as either a png or a jpeg. I also need to use this method cannot use the raw data to create graphs.
答案1
得分: -1
尝试在导出代码之前添加以下代码行:
chartObject.Copy
英文:
You are only saving a chart object with the name of a png file.
try adding the line:
chartObject.Copy
before the line where you do the export.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论