你好,
感谢您的留言。您可以参考下面代码进行判断,如果测试有其他问题,请提供你的文档给我们进一步调查,你可以在这里上传或通过邮件(
[email protected])提供给我们。
- Code: Select all
Document document = new Document();
document.LoadFromFile(@"E:\works\day3.20\consumerFile\q.docx");
Regex regex = new Regex(@"\「.糬\」");
TextSelection[] textSelections1 = document.FindAllPattern(regex);
foreach (TextSelection textSelection in textSelections1)
{
textSelection.GetAsOneRange().CharacterFormat.HighlightColor = Color.Yellow;
}
//save the document
document.SaveToFile("output.docx", FileFormat.Docx);
Best Regards,
Herman
E-iceblue support team