紧紧紧!!!控制WORD问题 我用DELPHI控制WORD,请问核心技术是什么??需要什么中间件啊??请救!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 无需中间件,OLE方式操作即可. 郁闷,找FASTREPROT,里面有-》WORD的玩2 OLE OleContainer1.CreateObject('C:\1.DOC',FALSE); OleContainer1.DoVerb(0); Delphi程序启动Word:需要Uses ComObj;使用CreateOleObject('Word.Application')启动WordDelphi程序新建Word文稿格式:WordDocuments.Add(Template,NewTemplate,DocumentType,Visible)Template: 使用模板的名称,NewTemplate: 新建文档的类型,True表示为模板,False表示为文档DocumentType: 文档类型,默认为空白文档Visible: 打捞的窗口是否可见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: 打开文档的窗口是否可见Delphi程序保存Word文稿格式:WordDocuments.SaveAs(FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter)FileName: 文件名。默认为当前文件夹和文件名。FileFormat 文档保存的格式。LockComments 如果为 True,则此文档只允许进行批注。Password 打开文档时的口令。AddToRecentFiles 如果为True,则将文档添至"文件"菜单中最近使用的文档列表中。WritePassword 保存对文档的修改所需的口令。ReadOnlyRecommended 如果为 True,在每次打开文档时,Word 将建议用户采用只读方式。EmbedTrueTypeFonts 如果为 True,则将文档与 TrueType 字体一起保存。SaveNativePictureFormat 如果为 True,则从其他系统平台(例如 Macintosh)导入的图形仅保存其 Windows 版本。SaveFormsData 如果为 True,则将窗体中用户输入的数据存为一条数据记录。SaveAsAOCELetter 如果文档包含一个附加,当此属性值为 True 时,将文档存为一篇 AOCE 信笺(同时保存邮件)。其他操作Word的代码请看VBA参考 不需要用OLE就可以TWordApplication的使用Google上可以找到的我以前也在CSDN上讲过的 在word的安装目录下找 VBAWD10.CHM 这个文件,里面有很多关于word的控制介绍 我曾经写过得一段代码var wordapp: variant;begin try try wordapp := createoleobject('word.application'); except showmessage('not found word in your system, so can not create file!'); exit; end; wordapp.visible := true; wordapp.Documents.Add(DocumentType := wdNewBlankDocument); wordapp.Selection.Font.Name := 'Arial'; wordapp.Selection.Font.Size := 16; wordapp.Selection.TypeText('致___________________:'); wordapp.Selection.TypeParagraph; wordapp.Selection.ParagraphFormat.Alignment := wdAlignParagraphRight; wordapp.Selection.TypeText(datetostr(date)); finally varclear(wordapp); end;end; 说句实在话,如果你仔细看过光盘自带的示例,你会发现在projects文件夹的Activx文件夹的word98有个单元只须将你的程序包含这个单元即可,其中:Twordobject类 考考Delphi的基础 已知句柄怎么获得对应的内存区域。 richedit右键菜单 TreeView问题 问一个巨简单的问题 一个有关QuantumGrid的显示问题,急!!! Oracle与C编程底层软件。哪个比较有前途??? 求职:Delphi程序员 关于一SQL语句写法(在ORACLE)下 怎样实现combobox的智能搜索功能?就象ie的地址栏一样 打印控件组 TIdTCPClient,使用读取线程中的问题
OleContainer1.DoVerb(0);
需要Uses ComObj;使用CreateOleObject('Word.Application')启动WordDelphi程序新建Word文稿
格式:WordDocuments.Add(Template,NewTemplate,DocumentType,Visible)
Template: 使用模板的名称,
NewTemplate: 新建文档的类型,True表示为模板,False表示为文档
DocumentType: 文档类型,默认为空白文档
Visible: 打捞的窗口是否可见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: 打开文档的窗口是否可见
Delphi程序保存Word文稿
格式:WordDocuments.SaveAs(FileName, FileFormat, LockComments, Password,
AddToRecentFiles, WritePassword, ReadOnlyRecommended,
EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData,
SaveAsAOCELetter)FileName: 文件名。默认为当前文件夹和文件名。
FileFormat 文档保存的格式。
LockComments 如果为 True,则此文档只允许进行批注。
Password 打开文档时的口令。
AddToRecentFiles 如果为True,则将文档添至"文件"菜单中最近使用的文档列表中。
WritePassword 保存对文档的修改所需的口令。
ReadOnlyRecommended 如果为 True,在每次打开文档时,Word 将建议用户采用只读方式。
EmbedTrueTypeFonts 如果为 True,则将文档与 TrueType 字体一起保存。
SaveNativePictureFormat 如果为 True,则从其他系统平台(例如 Macintosh)导入的图形仅保存其 Windows 版本。
SaveFormsData 如果为 True,则将窗体中用户输入的数据存为一条数据记录。
SaveAsAOCELetter 如果文档包含一个附加,当此属性值为 True 时,将文档存为一篇 AOCE 信笺(同时保存邮件)。其他操作Word的代码请看VBA参考
用OLE就可以
TWordApplication的使用
Google上可以找到的
我以前也在CSDN上讲过的
var
wordapp: variant;
begin
try
try
wordapp := createoleobject('word.application');
except
showmessage('not found word in your system, so can not create file!');
exit;
end;
wordapp.visible := true;
wordapp.Documents.Add(DocumentType := wdNewBlankDocument);
wordapp.Selection.Font.Name := 'Arial';
wordapp.Selection.Font.Size := 16;
wordapp.Selection.TypeText('致___________________:');
wordapp.Selection.TypeParagraph;
wordapp.Selection.ParagraphFormat.Alignment := wdAlignParagraphRight;
wordapp.Selection.TypeText(datetostr(date));
finally
varclear(wordapp);
end;
end;
其中:
Twordobject类