void HighlightTextRange(Office.TextRange2 textRange, Core.Parser parser)
 {
     textRange.Font.Fill.ForeColor.RGB = System.Drawing.Color.Black.ToMsoColor();
     foreach (var f in parser.Parse(textRange.Text))
     {
         // NOTE: indices of Characters are 1-based
         textRange.get_Characters(1 + f.Start, f.Length).Font.Fill.ForeColor.RGB = f.ForegroundColor.ToMsoColor();
     }
 }
        void HighlightTextRange(Office.TextRange2 textRange, Core.Parser parser)
        {
            var text = textRange.Text;
            if (string.IsNullOrEmpty(text))
                return;
            // reset text color.
            textRange.Font.Fill.ForeColor.RGB = System.Drawing.Color.Black.ToMsoColor();

            foreach (var f in parser.Parse(text))
            {
                // NOTE: indices of Characters are 1-based
                textRange.get_Characters(1 + f.Start, f.Length).Font.Fill.ForeColor.RGB = f.ForegroundColor.ToMsoColor();
            }
        }