CodePudding user response:
Suggest you send a sample file to see,A file samples, what content should be extracted,
CodePudding user response:
VB realize the OCR character recognition
Principle: use Microsoft OCR controls, takes less than 10 lines of code will be able to realize their own OCR character recognition software.
1. Add controls, you need to install office2003, not installed office2003 can copy from the other machine related files, register regsvr32. Exe mdivwctl. DLL,
Controls in the directory: C: \ Program Files \ Common Files \ Microsoft Shared \ MODI \ 11.0, have to do is related to several Files, this folder all documents about 21 m.
Engineering - & gt; Components - & gt; Add this control: Microsoft Office Document Imaging 11.0 Type Library
2. In button Click event:
Dim strLayoutInfo As String, strLPN As String
'initialization and load document
The Set miDoc=CreateObject (" MODI. Document ") 'create objects
MiDoc. Create "D: \ unnamed. Tif" 'loading image file (must be black and white binary chart)
Screen. MousePointer set cursor=vbHourglass 'busy
'recognition
MiDoc. Images (0). The OCR miLANG_CHINESE_SIMPLIFIED, True, True 'useful in this way, identified as Chinese simplified
Set modiLayout=miDoc. Images (0). The read data Layout '
StrLayoutInfo=_
"Language:" & amp; ModiLayout. Language & amp; VbCrLf & amp; _
"The Number of characters:" & amp; ModiLayout. NumChars & amp; VbCrLf & amp; _
"The Number of fonts:" & amp; ModiLayout. NumFonts & amp; VbCrLf & amp; _
"The Number of words:" & amp; ModiLayout. NumWords & amp; VbCrLf & amp; _
"The Beginning of the text:" & amp; Left (modiLayout. Text, 50) & amp; VbCrLf & amp; _
"The First word of the text:" & amp; ModiLayout. Words (0). The Text
MsgBox strLayoutInfo vbInformation + vbOKOnly, "Layout Information", "
The Set modiLayout=Nothing
The Set miDoc=Nothing
Screen. MousePointer=vbDefault
3. OK, is very simple
CodePudding user response:
Cad should integrate the vba, you go and see the classes, for such object should be a collection of directly through lixia, similar to the inside of the PPT of vba shape