我想替换我的word文件标题区域中的一些文本 实际的替换工作,但它取代所有大写,无论替换文本如何真实。 这是我使用的代码:
og = ""
vn = ""
nn = ""
tl = ""
fx = ""
getUserdatadata()
Dim tags As String() = {"XCDATEX", "XORGANIX", "XNAMEX", "XTELEX", "XFAXX"}
Dim name As String = vn + " " + nn
Dim replaces As String() = {Today.ToShortDateString, og, name, tl, fx}
worddoc.Application.ActiveWindow.ActivePane.View.Type = WdViewType.wdPrintView
worddoc.ActiveWindow.ActivePane.View.SeekView = WdSeekView.wdSeekFirstPageHeader
For i As Integer = 0 To 4
With worddoc.Application.Selection.Find
.Text = tags(i)
.Replacement.Text = replaces(i)
.Forward = True
.Wrap = WdFindWrap.wdFindContinue
.Execute(Replace:=WdReplace.wdReplaceOne)
End With
Next
对于日期,组织,电话和传真没有问题(组织完全处于大写状态)。 但是对于名称,它总是将整个文本转换为大写。 如何解决这个问题?
答案 0 :(得分:2)
.MatchCase = true