0

我需要自动将 html 文件转换为 MS Word 文件,作为其中的一部分,我想删除所有样式的 ocorancesNormal (Web)并将它们替换为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)
}

有效但很慢。有更快的方法吗?

4

1 回答 1

0

找到了一个不能替代但具有预期效果的方法:

$style = $word.ActiveDocument.Styles.Item("Normal (Web)")
$style.Delete()
于 2011-08-22T20:33:00.783 回答