翻譯|使用教程|編輯:李顯亮|2021-09-08 10:47:10.827|閱讀 254 次
概述:在本文中,您將學(xué)習(xí)如何在 PowerPoint 演示文稿中自動(dòng)復(fù)制幻燈片。特別是,本文將介紹如何使用 C# 在 PowerPoint 演示文稿中克隆幻燈片或從一個(gè)演示文稿克隆到另一個(gè)演示文稿。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
在某些情況下,您可能需要克隆 PowerPoint 演示文稿中的幻燈片。克隆過程在不更改原始幻燈片的情況下在另一個(gè)演示文稿中或另一個(gè)演示文稿中制作幻燈片的副本。
在本文中,您將學(xué)習(xí)如何在 PowerPoint 演示文稿中自動(dòng)復(fù)制幻燈片。特別是,本文將介紹如何使用 C# 在 PowerPoint 演示文稿中克隆幻燈片或從一個(gè)演示文稿克隆到另一個(gè)演示文稿。
為了在 PPTX 或 PPT 演示文稿中克隆幻燈片,我們將使用Aspose.Slides for .NET,它是一種演示操作 API,可讓您創(chuàng)建、修改和轉(zhuǎn)換 PowerPoint 和 OpenOffice 演示文稿。
>>你可以點(diǎn)擊這里下載Aspose.Slides 最新版測試體驗(yàn)。
可以在指定位置或在 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); }
在本節(jié)中,將學(xué)習(xí)如何將幻燈片從一個(gè)演示文稿克隆到另一個(gè)演示文稿。以下小節(jié)將介紹在目標(biāo)演示文稿的末尾或特定位置復(fù)制幻燈片。
以下是使用 C# 在另一個(gè)演示文稿的末尾克隆幻燈片的步驟。
以下代碼示例展示了如何將幻燈片從一個(gè)演示文稿克隆到另一個(gè)演示文稿。
// 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# 在另一個(gè)演示文稿中的特定位置克隆幻燈片的步驟。
以下代碼示例展示了如何將幻燈片克隆到另一個(gè) 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的全部完整功能,可聯(lián)系在線客服獲取30天臨時(shí)授權(quán)體驗(yàn)。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn