【发布时间】:2012-05-04 06:55:44
【问题描述】:
我想使用 C# 和互操作,用 Microsft Word 文档中的普通段落标记代码 ^p 替换段落标记 (^13) 的所有替代代码。
我一直在使用 Microsoft.Office.Interop.Word.Selection.Find.Execute() 方法。
例如..
.Application.ActiveWindow.Selection.Find.Execute(
ref findText,
ref matchCase,
ref matchWholeWord,
ref matchWildcards,
ref matchSoundsLike,
ref matchAllWordForms,
ref findForward,
ref findWrap,
ref findFormat,
ref replaceText,
ref replaceAll,
ref missing,
ref missing,
ref missing,
ref missing);
- findText = "^13"
- matchCase = true
- matchWholeWord = true
- matchWildcards = true
- matchSoundsLike = 假
- matchAllWordForms = 假
- findForward = true
- findWrap = WdFindWrap.wdFindContinue
- findFormat = 假
- replaceText = "^p"
- replaceAll = WdReplace.wdReplaceAll
使用上面的代码,^13 标记不会被 ^p 标记替换。
有谁知道我该如何解决这个问题?
【问题讨论】:
-
当我使用 \r (而不是 ^13) 作为 findText 的值和 ^p 作为值 replaceText 然后上面的代码工作
标签: c# ms-word interop office-interop