文字识别多张图片,遇到不能识别的就卡住不往下进行了,怎样跳过当前图片,继续下一张图片识别?
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1") ‘列表视图中的文件名
For Each vr As WinForm.ListViewRow In lvw.Rows
If vr Is Nothing Then '如果不存在当前行
Return
Else
Dim doc = CreateObject("MODI.Document")
doc.Create(ProjectPath & "Attachments\" & vr.ImageKey) ’加入图片地址
doc.OCR(2052, True, True)
For ii As Integer = 0 To doc.Images.count - 1
Dim layout = doc.images(ii).Layout
Dim s As String = layout.text
Dim rt = e.Form.Controls("Panelx").BaseControl.Controls("richTextBox1") '将内容写入文本框
rt.text = " " & rt.text & s & vbcrlf & vbcrlf & "
Next
doc.close
doc = Nothing
End If
Next