我想删除下划线。但是下面的代码太慢了

I want to remove the underline. But the code below is too slow

我想去掉下划线(wdUnderlineWavy)。 但是下面的代码太慢了。字符越多,它们变得越慢。 有没有更快的方法?

    void remove_underline()
    {

        Word.Range range;
        for (int i = 1; i < Application.ActiveDocument.Characters.Count; i++)
        {
            range = Application.ActiveDocument.Characters[i];


            if (range.Font.Underline == Word.WdUnderline.wdUnderlineWavy
                   && (range.Font.UnderlineColor == (Word.WdColor)254 ||
                   range.Font.UnderlineColor == (Word.WdColor)32769 ||
                   range.Font.UnderlineColor == (Word.WdColor)16711681))
            {
                range.Font.Underline = Word.WdUnderline.wdUnderlineNone;
            }
        }
    }
    void remove_underline()
    {
            Word.Range range;
            range = Application.ActiveDocument.Content;
            remove_underline(range, 254);
            remove_underline(range, 32769);
            remove_underline(range, 16711681);
    }
    void remove_underline(Word.Range range, int colorIndex) {
        range.Find.ClearFormatting();
        range.Find.Replacement.ClearFormatting();
        range.Find.Text = "";
        range.Find.Font.UnderlineColor = (Word.WdColor)colorIndex;
        range.Find.Font.Underline = Word.WdUnderline.wdUnderlineWavy;
        range.Find.Replacement.Text = "";
        range.Find.Replacement.Font.Underline = Word.WdUnderline.wdUnderlineNone;
        range.Find.Execute(Format: true,Replace:Word.WdReplace.wdReplaceAll);

    }

我解决了这个问题。 参考:https://social.msdn.microsoft.com/Forums/en-US/974a3a27-3ce9-43c6-9bbc-fbc39c6c0592/i-want-to-remove-the-underline-but-the-code-below-is-too-slow?forum=vsto