|
1金钱
请问各位大神,飞哥,我检索Word中的关键字时,比如“计算”,用函数很好检索到,但是比如关键字含有特殊字符,比如一个五角星,那怎么办啊,在c#的string中打不出这个字符啊,怎么办啊?
public int Find()
{
try
{
string[] KeyWord = { "机密","秘密" };
object readOnly = false;
int Times = 0;
foreach (string str in KeyWord)
{
string StrKey = str;
object strKey = StrKey;
Microsoft.Office.Interop.Word.Find wfnd;
if (_doc.Paragraphs != null && _doc.Paragraphs.Count > 0)
{
int iCount = _doc.Paragraphs.Count;
for (int i = 1; i <= iCount; i++)
{
wfnd = _doc.Paragraphs.Range.Find;
wfnd.ClearFormatting();
//wfnd.MatchCase = CaseSensitive;
wfnd.Text = strKey.ToString();
if (wfnd.Execute(ref MissingValue, ref MissingValue,
ref MissingValue, ref MissingValue,
ref MissingValue, ref MissingValue,
ref MissingValue, ref MissingValue,
ref MissingValue, ref MissingValue,
ref MissingValue, ref MissingValue,
ref MissingValue, ref MissingValue,
ref MissingValue))
{
|
|