1、参考代码,分析内容获取值,你的题目必须规则才行分析,读懂代码自行扩展。
Dim dlg As new OpenFileDialog
dlg.Filter = "word|*.doc;*.docx"
If dlg.ShowDialog = DialogResult.OK Then
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, ".+?答案.+?\r")
msgbox(mc.count)
For i As Integer = 0 To mc.count-1
msgbox(mc(i).value)
Next
app.Quit
catch ex As exception
msgbox(ex.message)
app.Quit
End try
End If
2、对于不是文本的内容,无法识别。