在 MS Word 中快速搜索和替换样式
我需要将 html 文件自动转换为 MS Word 文件,作为其中的一部分,我想删除 Normal (Web)
样式的所有 ocorances 并将它们替换为 Normal
代码>.
我正在使用以下
$find = $word.Selection.Find
$find.Style = $word.ActiveDocument.Styles.Item("Normal (Web)")
$find.Forward = $True
$find.Format = $True
while ($word.Selection.Find.Execute())
{
$word.Selection.Style = $word.ActiveDocument.Styles.Item("Normal")
$null = $word.Selection.EndKey(5)
}
有效但速度很慢的方法。有更快的方法吗?
I have the need to automate conversion of html files into MS Word files, and as part of it I want to remove all ocorances of style Normal (Web)
and replace them with just Normal
.
I'm using the following
$find = $word.Selection.Find
$find.Style = $word.ActiveDocument.Styles.Item("Normal (Web)")
$find.Forward = $True
$find.Format = $True
while ($word.Selection.Find.Execute())
{
$word.Selection.Style = $word.ActiveDocument.Styles.Item("Normal")
$null = $word.Selection.EndKey(5)
}
which works but is slow. Is there a faster way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了一个不能替代的方法,但具有预期的效果:
Found an approch which doesn't replace, but has the desired effect: