FindAndReplaceText()

SlideUtil::FindAndReplaceText(System::SharedPtr<IPresentation>, bool, System::String, System::String, System::SharedPtr<PortionFormat>) method

Finds and replaces text in presentation with given format

static void Aspose::Slides::Util::SlideUtil::FindAndReplaceText(System::SharedPtr<IPresentation> presentation, bool withMasters, System::String find, System::String replace, System::SharedPtr<PortionFormat> format=nullptr)

Arguments

ParameterTypeDescription
presentationSystem::SharedPtr<IPresentation>Scanned presentation.
withMastersboolDetermines whether master slides should be scanned.
findSystem::StringString value to find.
replaceSystem::StringString value to replace.
formatSystem::SharedPtr<PortionFormat>Format for replacing text portion. If null then will be used format of the first character of the found string

Remarks

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

auto format = System::MakeObject<PortionFormat>();
format->set_FontHeight(24.0f);
format->set_FontItalic(NullableBool::True);
auto fillFormat = format->get_FillFormat();
fillFormat->set_FillType(FillType::Solid);
fillFormat->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Red());

SlideUtil::FindAndReplaceText(pres, true, u"[this block] ", u"my text ", format);
pres->Save(u"replaced", SaveFormat::Pptx);

See Also