首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#对word操作中文本替换有关问题

2012-01-31 
C#对word操作中文本替换问题Word.DocumentwDocnullWord.ApplicationwAppnullSysFun.CreateWordDocumen

C#对word操作中文本替换问题
Word.Document   wDoc   =   null;
Word.Application   wApp   =   null;
SysFun.CreateWordDocument(   filePath   +   @ "\Bumph\Lawless.etog ",   ref   wDoc,   ref   wApp);

                        if   (wDoc.Content.Text.IndexOf( "测试 ")   >   0)
                        {
                                MessageBox.Show( "找出来了!! ");
                        }
可以找word文档里面的文本,但不懂如何替换,
用一个str替换掉 '测试 '


[解决办法]
if (wDoc.Content.Text.IndexOf( "测试 ") > 0)
{wDoc.Content.Text.Replace( "测试 ",str);

}

热点排行