ForEach

ForEach class

Represents a group of methods intended to iterate over different Presentation model objects. These methods can be useful if you need to iterate and change some Presentation’ elements formatting or content, e.g. change each portion formatting.

class ForEach

Methods

MethodDescription
ForEach()
static void LayoutSlide(System::SharedPtr<Presentation>, ForEach::ForEachLayoutSlideCallback)Iterate each ForEach::LayoutSlide in the Presentation.
static void MasterSlide(System::SharedPtr<Presentation>, ForEach::ForEachMasterSlideCallback)Iterate each ForEach::MasterSlide in the Presentation.
static void Paragraph(System::SharedPtr<Presentation>, ForEach::ForEachParagraphCallback)Iterate each ForEach::Paragraph in the Presentation.
static void Paragraph(System::SharedPtr<Presentation>, bool, ForEach::ForEachParagraphCallback)Iterate each ForEach::Paragraph in the Presentation.
static void Portion(System::SharedPtr<Presentation>, ForEach::ForEachPortionCallback)Iterate each ForEach::Portion in the Presentation.
static void Portion(System::SharedPtr<Presentation>, bool, ForEach::ForEachPortionCallback)Iterate each ForEach::Portion in the Presentation.
static void Shape(System::SharedPtr<Presentation>, ForEach::ForEachShapeCallback)Iterate each ForEach::Shape in the Presentation.
static void Shape(System::SharedPtr<Presentation>, bool, ForEach::ForEachShapeCallback)Iterate each ForEach::Shape in the Presentation.
static void Shape(System::SharedPtr<BaseSlide>, ForEach::ForEachShapeCallback)Iterate each ForEach::Shape in the BaseSlide.
static void Slide(System::SharedPtr<Presentation>, ForEach::ForEachSlideCallback)Iterate each ForEach::Slide in the Presentation.

Typedefs

TypedefDescription
ForEachSlideCallbackCallback that will be invoked for each ForEach::Slide in the Presentation.
ForEachMasterSlideCallbackCallback that will be invoked for each ForEach::MasterSlide in the Presentation.
ForEachLayoutSlideCallbackCallback that will be invoked for each ForEach::LayoutSlide in the Presentation.
ForEachShapeCallbackCallback that will be invoked for each ForEach::Shape in the Presentation.
ForEachParagraphCallbackCallback that will be invoked for each ForEach::Paragraph on the BaseSlide.
ForEachPortionCallbackCallback that will be invoked for each ForEach::Portion in the ForEach::Paragraph on the BaseSlide.

Remarks

auto presentation = System::MakeObject<Presentation>(u"pres.pptx");

auto lambda = [](SharedPtr<Portion> portion, SharedPtr<Paragraph> para, SharedPtr<BaseSlide> slide, int32_t index) -> void
{
    portion->get_PortionFormat()->set_LatinFont(System::MakeObject<FontData>(u"Times New Roman"));
};
auto callback = std::function<void(SharedPtr<Portion> portion, SharedPtr<Paragraph> para, SharedPtr<BaseSlide> slide, int32_t index)>(lambda);

ForEach::Portion(presentation, callback);

presentation->Save(u"pres-out.pptx", SaveFormat::Pptx);

See Also