翻譯|使用教程|編輯:李顯亮|2021-09-08 10:47:10.827|閱讀 254 次
概述:在本文中,您將學習如何在 PowerPoint 演示文稿中自動復制幻燈片。特別是,本文將介紹如何使用 C# 在 PowerPoint 演示文稿中克隆幻燈片或從一個演示文稿克隆到另一個演示文稿。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
在某些情況下,您可能需要克隆 PowerPoint 演示文稿中的幻燈片。克隆過程在不更改原始幻燈片的情況下在另一個演示文稿中或另一個演示文稿中制作幻燈片的副本。
在本文中,您將學習如何在 PowerPoint 演示文稿中自動復制幻燈片。特別是,本文將介紹如何使用 C# 在 PowerPoint 演示文稿中克隆幻燈片或從一個演示文稿克隆到另一個演示文稿。
為了在 PPTX 或 PPT 演示文稿中克隆幻燈片,我們將使用Aspose.Slides for .NET,它是一種演示操作 API,可讓您創建、修改和轉換 PowerPoint 和 OpenOffice 演示文稿。
>>你可以點擊這里下載Aspose.Slides 最新版測試體驗。
可以在指定位置或在 PowerPoint 演示文稿的末尾克隆幻燈片。
以下是使用 C# 在 PowerPoint 演示文稿末尾克隆幻燈片的步驟。
下面的代碼示例顯示了如何在 PowerPoint 演示文稿的末尾克隆幻燈片。
// Load presentation file using (Presentation pres = new Presentation("input.pptx")) { // Clone the desired slide to the end of the collection of slides in the same presentation ISlideCollection slds = pres.Slides; slds.AddClone(pres.Slides[0]); // Save presentation pres.Save("output.pptx", SaveFormat.Pptx); }
以下是使用 C# 在 PowerPoint 演示文稿中的特定位置克隆幻燈片的步驟。
以下代碼示例展示了如何在 PowerPoint 演示文稿中的特定位置克隆幻燈片。
// Load presentation file using (Presentation pres = new Presentation("input.pptx")) { // Access collection of slides in the same presentation ISlideCollection slds = pres.Slides; // Clone the desired slide to the specified index in the same presentation slds.InsertClone(2, pres.Slides[1]); // Save presentation pres.Save("output.pptx", SaveFormat.Pptx); }
在本節中,將學習如何將幻燈片從一個演示文稿克隆到另一個演示文稿。以下小節將介紹在目標演示文稿的末尾或特定位置復制幻燈片。
以下是使用 C# 在另一個演示文稿的末尾克隆幻燈片的步驟。
以下代碼示例展示了如何將幻燈片從一個演示文稿克隆到另一個演示文稿。
// Load source presentation file using (Presentation srcPres = new Presentation("source.pptx")) { // Load destination presentation (where slide is to be cloned) using (Presentation destPres = new Presentation("destination.pptx")) { // Clone the desired slide from the source presentation to the end of the collection of slides in destination presentation ISlideCollection slds = destPres.Slides; slds.AddClone(srcPres.Slides[0]); // Save presentation destPres.Save("destination_out.pptx", SaveFormat.Pptx); } }
以下是使用 C# 在另一個演示文稿中的特定位置克隆幻燈片的步驟。
以下代碼示例展示了如何將幻燈片克隆到另一個 PowerPoint 演示文稿中。
// Load source presentation file using (Presentation srcPres = new Presentation("source.pptx")) { // Load destination presentation (where slide is to be cloned) using (Presentation destPres = new Presentation("destination.pptx")) { // Clone the desired slide from the source presentation to specified location in destination presentation ISlideCollection slds = destPres.Slides; slds.InsertClone(2, srcPres.Slides[0]); // Save presentation destPres.Save("destination_out.pptx", SaveFormat.Pptx); } }
如果你想試用Aspose的全部完整功能,可聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn