首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

MiDocView控件有关问题

2012-03-29 
MiDocView控件问题使用office2003带的ocr控件,在网上找到一段代码,但运行出错Delphi(Pascal) codeprocedur

MiDocView控件问题
使用office2003带的ocr控件,在网上找到一段代码,但运行出错

Delphi(Pascal) code
 
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
请问该如何解决?


[解决办法]
用C++来做吧

热点排行