FindAndReplaceText
SlideUtil.FindAndReplaceText 方法
根据给定格式在演示文稿中查找和替换文本
public static void FindAndReplaceText(IPresentation presentation, bool withMasters, string find,
string replace, PortionFormat format = null)
参数 | 类型 | 描述 |
---|---|---|
presentation | IPresentation | 被扫描的演示文稿。 |
withMasters | Boolean | 确定是否应扫描母版幻灯片。 |
find | String | 要查找的字符串值。 |
replace | String | 要替换的字符串值。 |
format | PortionFormat | 替换文本部分的格式。如果为null,则使用找到字符串的第一个字符的格式 |
示例
[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);
}