HighlightText
内容
[
隐藏
]HighlightText(string, Color)
用指定的颜色高亮所有匹配的示例文本。
public void HighlightText(string text, Color highlightColor)
参数 | 类型 | 描述 |
---|---|---|
text | String | 要高亮的文本。 |
highlightColor | Color | 用于高亮文本的颜色。 |
另请参见
- interface ITextFrame
- 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
- interface ITextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides