导入到WORD?(130分)

我是用assess的
员工号 文本
姓名 文本
基本工资 文本
在职状态 文本
性 别 文本
模板.dot
姓 名 <姓名> 在职状态 <在职状态> 性 别 <性别>

 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,word2000,comobj, DB, ADODB, StdCtrls, OleServer;

type
TForm1 = class(TForm)
Button1: TButton;
WordApp: TWordApplication;
Button2: TButton;
Procedure Replace_string(Word_App:TWordApplication;Find_string,Replaced_string:string);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
i:integer;

implementation

{$R *.dfm}

Procedure TForm1.Replace_string(Word_App:TWordApplication;Find_string,Replaced_string:string);
var //查找替换WORD中的指定字符串
FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike,MatchKashida,MatchDiacritics,
MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace,MatchAlefHamza,MatchControl: OleVariant;
Range_start,Range_end,i,Range1:OleVariant;
Document_range:Range;
begin
FindText := Find_string;
MatchCase := False;
MatchWholeWord := True;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
Forward := True;
Wrap := wdFindContinue;
Format := False;
ReplaceWith := Replaced_string;
Replace := wdReplaceAll;
MatchKashida:= False;
MatchDiacritics:= False;
MatchAlefHamza:= False;
MatchControl:= False;
Document_range:=Word_App.ActiveDocument.Range(Range_start,Range_end);
Document_range.Select;
Word_App.Selection.Find.Execute( FindText, MatchCase, MatchWholeWord,
MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward,
Wrap, Format, ReplaceWith, Replace,MatchKashida,MatchDiacritics,
MatchAlefHamza,MatchControl);
end;
procedure TForm1.Button1Click(Sender: TObject);
var Replace_Range:OleVariant;
FileName,ConfirmConversions,ReadOnly,AddToRecentfiles,PasswordDocument,
PasswordTemplate,Revert,WritePasswordDocument,WritePasswordTemplate,
Format,Encoding,Visible:OleVariant;
begin
WordApp.Connect;
FileName:=GetCurrentDir+'/aaa.doc';
ConfirmConversions:=false;
ReadOnly:=false;
AddToRecentfiles:=false;
PasswordDocument:='';
PasswordTemplate:='';
Revert:=false;
WritePasswordDocument:='';
WritePasswordTemplate:='';
Format:=wdFormatDocument;
//Encoding
Visible:=true;
WordApp.Documents.Open(FileName,ConfirmConversions,ReadOnly,AddToRecentfiles,
PasswordDocument,PasswordTemplate,Revert,WritePasswordDocument,
WritePasswordTemplate,Format,Encoding,Visible);
wordApp.Visible:=true;
//Replace_string(Word_App:TWordApplication;Find_string,Replaced_string:string);
end;

procedure TForm1.Button2Click(Sender: TObject);
var Replace_Range: TWordApplication;
Find_string,ReplacedWith:string;
begin
Replace_Range:=WordApp;
Replace_string(Replace_Range,'<#文档编号#>','ddd');
Replace_string(Replace_Range,'<#文档名称#>','eee');
Find_string:='<#工程类别#>';
ReplacedWith:='aaa';
Replace_string(Replace_Range,find_string,Replacedwith);
Find_string:='<#工程编号#>';
ReplacedWith:='bbb';
Replace_string(Replace_Range,find_string,Replacedwith);
Find_string:='<#工程名称#>';
ReplacedWith:='ccc';
Replace_string(Replace_Range,find_string,Replacedwith);
end;

end.
 
我做个例子,留下EMail,我发给你。
 
yejsj@163.net
 
To:wlh_1
能给我发一个吗,chxy97@163.com
 
To:linsb
能给我发一个吗,chxy97@163.com
 
留 E-mail 发一份给我。。
juanke@163.com
 
谁会EXCEL导到assess中?
 
ehlib有这个功能.我用过.
 
顶部