1.OLEContainer是不是只能显示WORD中第一页的内容啊,如果能显示多页要用什么方法?
2.OLEContainer如何实现显示滚动条,我试过用DoVerb()方法,但这样就把整个WORD打开了,我想要的效果是只显示WORD中的内容,要用什么方法?还是得用其他组件? 

解决方案 »

  1.   

    1.不是只能显示第一页的内容procedure TForm1.Button1Click(Sender: TObject);
    begin
      self.OleContainer1.CreateObjectFromFile('f:\123.doc',False);
      self.OleContainer1.DoVerb(ovOpen);//以word的独立显示
      self.OleContainer1.OleObject.application.ActiveDocument.unProtect('123');
      self.OleContainer1.OleObject.application.visible:=False;//word界面不显示
      //self.OleContainer1.OleObject.application.ActiveDocument.Protect(wdAllowOnlyFormFields,True,'123');//设置保护,只读 保护密码123
      //Self.OleContainer1.OleObject.application.displayalerts:=False;//不显示提示框
      //self.OleContainer1.OleObject.application.ActiveDocument.saveas('f:\123.doc');//另存
      self.OleContainer1.DoVerb(ovShow);//在OleContainer1中显示word文档
    end;
      

  2.   

    如果只是为了显示,可以很简单的写成procedure TForm1.Button1Click(Sender: TObject);
    begin
      self.OleContainer1.CreateObjectFromFile('f:\123.doc',False);
      self.OleContainer1.DoVerb(ovShow);//在OleContainer1中显示word文档
    end;