如何通过vb.net
删除 Microsoft Word 中的彩色文字Public Class Form1
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oRng As Word.Range
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
oWord = New Word.Application
oDoc = oWord.Documents.Open("C:\file.docx")
oWord.Visible = True
oRng = oDoc.Content
If oRng.Font.Color = Word.WdColor.wdColorBlack Then
oRng.Delete()
End If
oWord.Documents.Item(1).Save()
oWord.Quit()
oWord = Nothing
End Sub
End Class