以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]代码的后半段没有执行  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=109689)

--  作者:天一生水
--  发布时间:2017/11/17 10:49:00
--  [求助]代码的后半段没有执行

文字识别后,再替换识别后的不规范字符:

 

’文字识别
Dim doc = CreateObject("MODI.Document")
doc.Create(e.Form.Controls("TextBox1").value )
doc.OCR(2052, True, True)
For i As Integer = 0 To doc.Images.count - 1
    Dim layout = doc.images(i).Layout
    e.Form.Controls("TextBox1").value = layout.text & vbcrlf
\'msgbox(layout.text)
Next i
doc.close
doc = Nothing


’字符替换
Dim s As String = e.Form.Controls("TextBox1").value
s = s.Replace(" ","")
s = s.Replace(".","。")
s = s.Replace(".","。")
s = s.Replace("【","[")
s = s.Replace("】","]")
s = s.Replace(":",":")
s = s.Replace(";",";")

 

上述代码分别执行没问题,合在一起时,后边的没有执行,代码能不能合在一起?

谢谢!

 


--  作者:有点甜
--  发布时间:2017/11/17 10:52:00
--  

 

[此贴子已经被作者于2017/11/17 10:52:23编辑过]

--  作者:有点甜
--  发布时间:2017/11/17 10:54:00
--  

改成这样,执行弹出什么?

 

\'\'\'

\'文字识别
Dim doc = CreateObject("MODI.Document")
doc.Create(e.Form.Controls("TextBox1").value )
doc.OCR(2052, True, True)
For i As Integer = 0 To doc.Images.count - 1
    Dim layout = doc.images(i).Layout
    e.Form.Controls("TextBox1").value = layout.text & vbcrlf
    \'msgbox(layout.text)
Next i
msgbox(1)
doc.close
doc = Nothing

msgbox(2)
\'字符替换
Dim s As String = e.Form.Controls("TextBox1").value
s = s.Replace(" ","")
s = s.Replace(".","。")
s = s.Replace(".","。")
s = s.Replace("【","[")
s = s.Replace("】","]")
s = s.Replace(":",":")
s = s.Replace(";",";")
msgbox(3)
msgbox(s)


--  作者:天一生水
--  发布时间:2017/11/17 11:14:00
--  

最后再加一句代码,就行了,谢谢!

e.Form.Controls("TextBox1").value = s