查找并替换word文档中的模式
我想在word中找到一个模式并用VB.NET替换为其他文本
I want to find a pattern in word and replace it with other text with VB.NET
我是使用以下代码执行相同的操作:
I am using the following code to do the same :
Dim range As Range = doc.Range
Dim reg As New Regex(" ^ \s +")
Dim rangeText As String = range.Text
range.Text = reg.Replace(rangeText," bbbbb")
Dim range As Range = doc.Range
Dim reg As New Regex("^\s+")
Dim rangeText As String = range.Text
range.Text = reg.Replace(rangeText, "bbbbb")
但是如果我的内容包含"HYPERLINKS",它也会删除它。我知道还有其他的方式吗我也可以这样做。
But if my content contains "HYPERLINKS", it removes that also.Can i know is there any other way that i can do the same.
提前致谢。
我想在word中找到一个模式并用VB.NET替换为其他文本
I want to find a pattern in word and replace it with other text with VB.NET
我使用以下内容代码也是如此:
I am using the following code to do the same :
Dim range As Range = doc.Range
Dim reg As New Regex(" ^ \s +")
Dim rangeText As String = range.Text
range.Text = reg.Replace(rangeText," bbbbb")
Dim range As Range = doc.Range
Dim reg As New Regex("^\s+")
Dim rangeText As String = range.Text
range.Text = reg.Replace(rangeText, "bbbbb")
但是如果我的内容包含"HYPERLINKS",它也会删除它。我知道还有其他的方式吗我也可以这样做。
But if my content contains "HYPERLINKS", it removes that also.Can i know is there any other way that i can do the same.
提前致谢。