如题,用ReadAllText方法读取word内容,不论设置什么
Encoding类型,都是乱码!怎么办?
另外,求组高亮代码的意思,没学过VBA看不太懂
Dim app As New MSWord.Application
try
Dim doc = app.Documents.Open(dlg.fileName)
Dim count = Doc.Characters.Count
Dim rng As MSWord.Range = Doc.Range(Start:=0, End:=count)
msgbox(rng.Text)
Dim str As String = rng.text
Dim mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=裁定如下).*?(?=审 判 长)")
If mc.count >= 1 Then
msgbox("裁定")
For i As Integer = 0 To mc.count-1
msgbox(mc(i).value)
Next
Else
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=判决如下).*?(?=审 判 长)")
If mc.count >= 0 Then
msgbox("判决")
For i As Integer = 0 To mc.count-1
msgbox(mc(i).value)
Next
Else
msgbox("无法识别")
End If
End If
app.Quit
catch ex As exception
msgbox(ex.message)
app.Quit
End try
End If