You can find detailed information at: Apply Animation to Text in PowerPoint using C++
Last active
October 4, 2021 10:39
-
-
Save aspose-com-gists/92acf66108007302f1a992adc9ae9137 to your computer and use it in GitHub Desktop.
Apply Animation to Text in PowerPoint using C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File paths | |
const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation2.pptx"; | |
const String outputFilePath = u"OutputDirectory\\ApplyTextAnimation.pptx"; | |
// Load the Presentation file | |
SharedPtr<Presentation> presentation = MakeObject<Presentation>(sourceFilePath); | |
// Access the shape | |
SharedPtr<IAutoShape> autoShape = System::DynamicCast_noexcept<Aspose::Slides::IAutoShape>(presentation->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0)); | |
// Access the paragraph | |
auto paragraph = autoShape->get_TextFrame()->get_Paragraphs()->idx_get(0); | |
// Add the effect | |
auto effect = presentation->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence()->AddEffect(paragraph, EffectType::Fly, EffectSubtype::Left, EffectTriggerType::OnClick); | |
// Save Presentation file | |
presentation->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Pptx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File path | |
const String sourceFilePath = u"OutputDirectory\\ApplyTextAnimation.pptx"; | |
// Load the Presentation file | |
SharedPtr<Presentation> presentation = MakeObject<Presentation>(sourceFilePath); | |
// Get the sequence | |
auto sequence = presentation->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence(); | |
// Access the shape | |
SharedPtr<IAutoShape> autoShape = System::DynamicCast_noexcept<Aspose::Slides::IAutoShape>(presentation->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0)); | |
// Loop through the paragraphs | |
for (SharedPtr<IParagraph> paragraph : autoShape->get_TextFrame()->get_Paragraphs()) | |
{ | |
// Get the effects | |
auto effects = sequence->GetEffectsByParagraph(paragraph); | |
if (effects->get_Length() > 0) | |
{ | |
// Print to the console | |
Console::WriteLine(String::Format(u"Paragraph {0} has {1} effect.", paragraph->get_Text(), effects->idx_get(0)->get_Type())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment