使用office2003带的ocr控件,在网上找到一段代码,但运行出错procedure TForm.Button1Click(Sender: TObject);
Var
doc :IDocument;
Img :IImage;
Layout :ILayout;
begin
doc := IDispatch(CreateOleObject('MODI.Document')) as IDocument;
doc.create(FileName); // just put here the filename of an image
doc.OCR(miLANG_ENGLISH,true,true);
Img := IDispatch(doc.Images[0]) as IImage;
Layout := IDispatch(Img.Layout) as ILayout;
Memo1.Lines.Add(Layout.Text);
MiDocView1.Document := doc;
doc.Close(false);
Img := nil;
Layout := nil;
end; http://www.delphi3000.com/articles/article_4253.asp运行后弹出错误对话框,提示:Object hasn't been initialized and can't be used yet
请问该如何解决?
Var
doc :IDocument;
Img :IImage;
Layout :ILayout;
begin
doc := IDispatch(CreateOleObject('MODI.Document')) as IDocument;
doc.create(FileName); // just put here the filename of an image
doc.OCR(miLANG_ENGLISH,true,true);
Img := IDispatch(doc.Images[0]) as IImage;
Layout := IDispatch(Img.Layout) as ILayout;
Memo1.Lines.Add(Layout.Text);
MiDocView1.Document := doc;
doc.Close(false);
Img := nil;
Layout := nil;
end; http://www.delphi3000.com/articles/article_4253.asp运行后弹出错误对话框,提示:Object hasn't been initialized and can't be used yet
请问该如何解决?
解决方案 »
- 哪位兄弟知道哪里有操作系统下载的!!
- 请教用OPEN API在FORM上添一控件
- rave编辑器中怎么找到指定的对象?
- function AllocateHWnd(Method: TWndMethod): HWND; 有谁知道是干什么的吗?
- 实现的问题,up 有分!!!
- 用query如何判断一条记录编号在表中是否存在??
- spcomm串口通讯的速度问题
- 高手请进,来者有分
- ●☆★●☆★Data2000 v1.1正式发布(想要1157条delphi代码吗?)★☆●★☆●
- Focus(老鱼) 、tikkypeng(千两狂死郎) 还有在线的各位,帮个忙
- delphi 2006 在Default Layout 模式下能全屏吗?
- 有个EXE文件怎么反编译成源码啊?
doc.OCR(miLANG_ENGLISH,true,true);