HighlightText
内容
[
隐藏
]HighlightText(string, Color)
使用指定的颜色高亮显示所有匹配的示例文本。
public void HighlightText(string text, Color highlightColor)
参数 | 类型 | 描述 |
---|---|---|
text | String | 要高亮显示的文本示例。 |
highlightColor | Color | 用于高亮显示文本的颜色。 |
另见
- class TextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides
HighlightText(string, Color, ITextSearchOptions, IFindResultCallback)
使用指定的颜色高亮显示所有匹配的示例文本。
public void HighlightText(string text, Color highlightColor, ITextSearchOptions options,
IFindResultCallback callback)
参数 | 类型 | 描述 |
---|---|---|
text | String | 要高亮显示的文本。 |
highlightColor | Color | 用于高亮显示文本的颜色。 |
options | ITextSearchOptions | 文本搜索选项 ITextSearchOptions 。 |
callback | IFindResultCallback | 接收搜索结果的回调对象 IFindResultCallback 。 |
示例
以下代码示例演示如何在 TextFrame 中高亮显示文本。
[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx"))
{
// 高亮显示所有单词 'important'
((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.HighlightText("important", Color.LightBlue);
// 高亮显示所有独立的 'the' 出现
((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.HighlightText("the", Color.Violet, new TextSearchOptions()
{ WholeWordsOnly = true }, null);
presentation.Save("SomePresentation-out2.pptx", SaveFormat.Pptx);
}
另见
- interface ITextSearchOptions
- interface IFindResultCallback
- class TextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides