++的博客

你看不见我,你看不见我。。
随笔 - 22, 文章 - 0, 评论 - 2, 引用 - 0
数据加载中……

调用Office2003的OCR功能识别图片上的文字

    int miLANG_CHINESE_SIMPLIFIED = 2052;
                        IDocument 
*pDoc = new IDocument;
                        pDoc
->CreateDispatch( _T("MODI.Document") );
                        pDoc
->Create(GetAppPath() + _T("out.bmp"));
                        pDoc
->OCR( miLANG_CHINESE_SIMPLIFIED, 00 );
                        IImages images 
= pDoc->GetImages();
                        
long      num =images.GetCount();
                        
forint i = 0; i < num; i++ )
                        

                            IImage  image 
= images.GetItem(i);
                            ILayout layout 
= image.GetLayout();
                            strTemp.Append( layout.GetText());
                        }

                        pDoc
->Close(0);
                        pDoc
->ReleaseDispatch();
                        delete pDoc;

还需要导入Office2003的Dispatch接口包装类
mdivwctl.h

mdivwctl.cpp

posted on 2008-04-28 13:07 Jerry.Wang 阅读(5067) 评论(0)  编辑 收藏 引用