FindAndReplaceText

SlideUtil.FindAndReplaceText Methode

Findet und ersetzt Text in Präsentationen mit gegebenem Format

public static void FindAndReplaceText(IPresentation presentation, bool withMasters, string find, 
    string replace, PortionFormat format = null)
ParameterTypBeschreibung
presentationIPresentationDurchsuchte Präsentation.
withMastersBooleanBestimmt, ob Masterfolien durchforstet werden sollen.
findStringZu suchender Stringwert.
replaceStringZu ersetzender Stringwert.
formatPortionFormatFormat zum Ersetzen des Textabschnitts. Wenn null, wird das Format des ersten Zeichens der gefundenen Zeichenfolge verwendet.

Beispiele

[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);
}

Siehe auch