原創|使用教程|編輯:張瑩心|2021-10-27 15:41:05.243|閱讀 238 次
概述:幻燈片切換是在從一張幻燈片導航到另一張幻燈片時顯示的效果。這些增強了演示文稿的外觀和感覺,并使它們更具吸引力。在某些情況下,可能需要以編程方式將幻燈片切換添加到 PowerPoint 文件。為此,本文將教您如何使用 C++ 向 PowerPoint 幻燈片添加過渡。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
幻燈片切換是在從一張幻燈片導航到另一張幻燈片時顯示的效果。這些增強了演示文稿的外觀和感覺,并使它們更具吸引力。在某些情況下,可能需要以編程方式將幻燈片切換添加到 PowerPoint 文件。為此,本文將教您如何使用 C++ 向 PowerPoint 幻燈片添加過渡。
>>你可以點擊這里下載Aspose.Slides 最新版測試體驗。
Aspose.Slides for C++ 是一個用于處理 PowerPoint 文件的 C++ API。它無需安裝 Microsoft PowerPoint 即可創建、閱讀和更新 PowerPoint 文件。此外,該 API 允許向 PowerPoint 演示文稿添加幻燈片過渡。
// File paths const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; const String outputFilePath = u"OutputDirectory\\AddTransition_out.pptx"; // Load the presentation file auto presentation = System::MakeObject<Presentation>(sourceFilePath); // Apply circle type transition on slide 1 presentation->get_Slides()->idx_get(0)->get_SlideShowTransition()->set_Type(Aspose::Slides::SlideShow::TransitionType::Circle); // Apply comb type transition on slide 2 presentation->get_Slides()->idx_get(1)->get_SlideShowTransition()->set_Type(Aspose::Slides::SlideShow::TransitionType::Comb); // Save Presentation presentation->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Pptx);
以下是使用 C++ 向幻燈片添加高級過渡的步驟。
// File paths const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; const String outputFilePath = u"OutputDirectory\\AddAdvancedTransition_out.pptx"; // Load the presentation file auto presentation = System::MakeObject<Presentation>(sourceFilePath); // Apply circle type transition on slide 1 presentation->get_Slides()->idx_get(0)->get_SlideShowTransition()->set_Type(Aspose::Slides::SlideShow::TransitionType::Circle); // Set the transition time of 3 seconds presentation->get_Slides()->idx_get(0)->get_SlideShowTransition()->set_AdvanceOnClick(true); presentation->get_Slides()->idx_get(0)->get_SlideShowTransition()->set_AdvanceAfterTime(3000); // Apply comb type transition on slide 2 presentation->get_Slides()->idx_get(1)->get_SlideShowTransition()->set_Type(Aspose::Slides::SlideShow::TransitionType::Comb); // Set the transition time of 5 seconds presentation->get_Slides()->idx_get(1)->get_SlideShowTransition()->set_AdvanceOnClick(true); presentation->get_Slides()->idx_get(1)->get_SlideShowTransition()->set_AdvanceAfterTime(5000); // Save Presentation presentation->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Pptx);
在演示文稿中使用變形過渡來制作幻燈片之間的平滑過渡動畫。以下部分介紹了如何在 Microsoft PowerPoint 中以及如何使用 C++ 以編程方式添加變形過渡。
以下是在 Microsoft PowerPoint 中添加變形過渡的步驟。
// File paths const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; const String outputFilePath = u"OutputDirectory\\AddMorphTransition_out.pptx"; // Load the presentation file auto presentation = System::MakeObject<Presentation>(sourceFilePath); // Add morph transition presentation->get_Slides()->idx_get(0)->get_SlideShowTransition()->set_Type(Aspose::Slides::SlideShow::TransitionType::Morph); auto morphTransition = System::DynamicCast<Aspose::Slides::SlideShow::IMorphTransition>(presentation->get_Slides()->idx_get(0)->get_SlideShowTransition()->get_Value()); morphTransition->set_MorphType(Aspose::Slides::SlideShow::TransitionMorphType::ByWord); // Save Presentation presentation->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Pptx);
如果你想試用Aspose的全部完整功能,可聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn