我使用下面的代码将图像从一个ppt复制到另一个ppt.but,它不起作用。
ppt = win32com.client.Dispatch('Powerpoint.Application')
ppt1 = ppt.Presentations.Open("path\\temp.pptx")
ppt2 = ppt.Presentations.Open("path\\2paste.pptx")
ppt1.slide.Shapes.Copy()
ppt2.slide.Shapes.Paste()这段代码打开了两个ppt,但它没有复制图像。
发布于 2022-05-13 14:45:45
使用Aspose.Slides for Python,您可以轻松地将任何形状从演示文稿复制到另一个表示。下面的代码示例向您展示了如何做到这一点:
import aspose.slides as slides
file_name1 = "temp.pptx"
file_name2 = "2paste.pptx"
with slides.Presentation(file_name1) as presentation1:
with slides.Presentation(file_name2) as presentation2:
# Get the first shape from the first slide, for example.
first_shape = presentation1.slides[0].shapes[0]
# Clone the shape and add the clone to the second presentation.
presentation2.slides[0].shapes.add_clone(first_shape)
# Save the second presentation.
presentation2.save(file_name2, slides.export.SaveFormat.PPTX)这是一个付费库,但您可以获得评估所有功能的临时许可证。我是Aspose的一个支持开发人员。
https://stackoverflow.com/questions/59713946
复制相似问题