我目前在做一个东东,要在程序中只读打开WORD文章,并且可以显示在程序中。各位帮我!

解决方案 »

  1.   

    OleContainer1
      if OleContainer1.InsertObjectDialog then
        OleContainer1.DoVerb (
          OleContainer1.PrimaryVerb);//
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      FileStr:String;
    begin
      if OpenDialog1.Execute then
        FileStr:=OpenDialog1.FileName;
      OleContainer1.CreateObjectFromFile(FileStr,False);
      OleContainer1.Run;
    end;
      

  3.   

    你也可以考虑用TWebBrowser组件来处理
      

  4.   

    一、Delphi程序启动Word
    采用CreateOleObjects的方法来启动Word,调用VBA代码,具体实现过程为:
    首先使用GetActiveOleObject('Word.Application')判断当前内存中是否存在Word程序,如果存在,
    则直接连接,如果没有Word程序,则使用CreateOleObject('Word.Application')启动Word二、Delphi程序新建Word文稿
    格式:WordDocuments.Add(Template,NewTemplate,DocumentType,Visible)
    Template: 使用模板的名称,
    NewTemplate: 新建文档的类型,True表示为模板,False表示为文档
    DocumentType: 文档类型,默认为空白文档
    Visible: 打捞的窗口是否可见举例:Doc_Handle:=Word_Ole.Documents.Add(Template:='C:\Temlate.dot',NewTemplate:=False);三、Delphi程序打开Word文稿
    格式:WordDocuments.Open(FileName,ConfirmConversions,ReadOnly,PassWordDocument,
                             PasswordTemplate,Revent,WritePasswordDocument,WritePassWordTemplate,
                             Format,Encoding,Visible)FileName: 文档名(包含路径)
    Confirmconversions: 是否显示文件转换对话框
    ReadOnly: 是否以只读方式打开文档
    AddToRecentFiles: 是否将文件添加到"文件"菜单底部的最近使用文件列表中
    PassWordDocument: 打开此文档时所需要的密码
    PasswordTemplate: 打开此模板时所需要的密码
    Revert: 如果文档已经,是否重新打开文档
    WritePasswordDocument: 保存对文档更改时所需要的密码
    WritePasswordTemplate: 保存对模板进行更改时所需要的密码
    Format: 打开文档时所需使用的文件转换器
    Encoding: 所使用的文档代码页
    Visible:  打开文档的窗口是否可见
      

  5.   

    采用OLE或Server页控件的可以 大富翁论坛上有不少帖子
      

  6.   

    if OpenDialog1.Execute then
      OleContainer1.CreateObjectFromFile(OpenDialog1.FileName,true);
    二、if OpenDialog1.Execute then
        Webbrowser1.navigate(opendialog1.fielname);
      

  7.   

    zhongguoshuai(zhongguoshuai) 
    说的方法比较简单,主要是利用了IE的特性。