怎样用servers面板下的WordApplication打开一个word文档,是不是用WordApplication.Documents.Open(),参数怎样设置?我用的是delphi6,谢谢
解决方案 »
- Delphi如何实现MDI各个子窗体的最大化、还原互不影响
- 请教。。。实现销售排名
- 动态创建窗体的问题
- !!程序为两个form,怎么设置才能使程序打开时,两个form同时显示
- 100分+一万分感激求助,请进。。。
- 在delphi8.0里,使用WinSock时在程序里写"uses WinSock",程序就会出错,应该怎么写?急急急
- 请问如何在运行表单前,先提示是否要保存,然后再运行,还有....
- 菜鸟的问题(HELP!):
- 想用acm控件写一个录音保存成文件的程序,大家给点建议.
- 如何将datetimepicker控件的时间,转化为'YYYY-MM-DD HH:MM'的形式?
- 哪位老兄用delphi做过象word一样的字处理软件?
- 突发其想,闲者来聚
itemindex :olevariant;
filename, confirmconversions, readonly, addtorecentfiles,
passworddocument, passwordtemplate, revert,
writepassworddocument, writepasswordtemplate, format: olevariant;
Encoding, Visible: olevariant;
begin
if not OpenDlg.execute then
exit; {open document}
filename := OpenDlg.filename;
confirmconversions := false;
readonly := false;
addtorecentfiles := false;
passworddocument := '';
passwordtemplate := '';
revert := true;
writepassworddocument := '';
writepasswordtemplate := '';
format := wdopenformatdocument;
Visible := true; wordapplication.documents.open(filename, confirmconversions,
readonly, addtorecentfiles, passworddocument, passwordtemplate,
revert, writepassworddocument, writepasswordtemplate, format,
Encoding, Visible ); {assign worddocument component}
itemindex := 1;
worddocument.connectto(wordapplication.documents.item(itemindex)); {turn spell checking of because it takes a long time if enabled and slows down winword}
wordapplication.options.checkspellingasyoutype := false;
wordapplication.options.checkgrammarasyoutype := false;
end;
软件版本:V1.02
更新日期:2003.9.18
运行环境:Win9x/2000/Nt/xp
支持语言:VC/VB/PB/Dephi/ASP/JSP
界面语言:简体中文
授权方式:试用软件
软件大小:1036KB
官方网址:http://www.standsoft.com
电子信箱:[email protected]
软件作者:深圳智岛软件有限公司
演示工程下载:http://www.oapro.com/ostarocx/download_demo.asp
在线演示:http://www.oapro.com/ostarocx/product_demo.asp
控件简介: 办公之星控件(OStarOCX)是智岛软件公司(http://www.standsoft.com)推出的一款基于图文混排的文档处理控件(类似Word的控件),办公之星控件(OStarOCX)完全封装了办公之星的文字、图形、表格、图表等功能,提供了几百个编程接口;在ERP、CRM、HR、OA等系统里,开发难度非常大的文档处理、统计、报表等输出功能都可由办公之星控件(OStarOCX)轻松实现,其所见即所得的效果跟现实里的完全一样。办公之星控件(OStarOCX)适用于Windows环境的各种开发工具(如VB,VC,Delphi,C+Builder, PB, Java等), 并且针对Web开发环境做了大量的优化。
procedure TForm1.Button1Click(Sender: TObject);
begin
try
Wordapplication1.Connect;
except
MessageDlg('Word may not be installed', mtError, [mbOk], 0);
Abort;
end;
Wordapplication1.Visible := True;
WordApplication1.Caption := 'Delphi automation';
end;
打开文件
procedure TForm1.Button1Click(Sender: TObject);
var
ItemIndex :OleVariant;
FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,
PasswordDocument, PasswordTemplate, Revert,
WritePasswordDocument, WritePasswordTemplate, Format: OleVariant;
begin
{Open document}
FileName := 'c:\a.txt';
ConfirmConversions := False;
ReadOnly := False;
AddToRecentFiles := False;
PasswordDocument := '';
PasswordTemplate := '';
Revert := True;
WritePasswordDocument := '';
WritePasswordTemplate := '';
Format := wdOpenFormatDocument; WordApplication1.Documents.Open( FileName, ConfirmConversions,
ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate,
Revert, WritePasswordDocument, WritePasswordTemplate, Format ); {Assign WordDocument component}
ItemIndex := 1;
WordDocument.ConnectTo(WordApplication1.Documents.Item(ItemIndex));{Turn Spell checking of because it takes a long time if enabled and slows down Winword}
WordApplication1.Options.CheckSpellingAsYouType := False;
WordApplication1.Options.CheckGrammarAsYouType := False;
end;
或者
Documents.Open FileName:="test.txt", ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto