FindAndReplaceText

SlideUtil.FindAndReplaceText method

Finds and replaces text in presentation with given format

public static void FindAndReplaceText(IPresentation presentation, bool withMasters, string find, 
    string replace, PortionFormat format = null)
ParameterTypeDescription
presentationIPresentationScanned presentation.
withMastersBooleanDetermines whether master slides should be scanned.
findStringString value to find.
replaceStringString value to replace.
formatPortionFormatFormat for replacing text portion. If null then will be used format of the first character of the found string

Examples

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
    PortionFormat format = new PortionFormat
    {
        FontHeight = 24f,
        FontItalic = NullableBool.True,
        FillFormat =
        {
            FillType = FillType.Solid,
            SolidFillColor =
            {
                Color = Color.Red
            }
        }
    };
    Aspose.Slides.Util.SlideUtil.FindAndReplaceText(pres, true, "[this block] ", "my text ", format);
    pres.Save("replaced", SaveFormat.Pptx);
}

See Also