var
Template,NewTemplate,DocumentType,Visible:OleVariant;
itemIndex:OleVariant;
fileName:Olevariant;
NoPrompt,OriginalFormat:OleVariant;
RouteDocument,SaveChanges:OleVariant;
vSelection: Selection;
vBookMark: BookMark;
vTable,VTable1,vTable2,vTable3,vtable4,vtable5: Table;
begin
wordApp.Connect();
wordApp.Visible:=true;
//template:=extractfilepath(application.ExeName)+'ld.dot';
template:=extractfilepath(application.exename)+'aebh.dot';
filename:='c:/temp001.doc';
NewTemplate:=False;
do
cumentType:=wdNewBlankDocument;
Visible:=true;
WordApp.Documents.Add(Template,NewTemplate,DocumentType,Visible);
//连接到新建的文档
itemIndex:=1;
WordDoc.ConnectTo(WordApp.Documents.Item(itemIndex));
vSelection := wordApp.Selection;
vTable := wordApp.ActiveDocument.Tables.Item(1);
vTable1 := wordApp.ActiveDocument.Tables.Item(2);
vTable2 := wordApp.ActiveDocument.Tables.Item(3);
vTable3 := wordApp.ActiveDocument.Tables.Item(4);
vTable4 := wordApp.ActiveDocument.Tables.Item(5);
vTable5 := wordApp.ActiveDocument.Tables.Item(6);
vTable.cell(1,1).Range.Text:='NO.'+myldbh;
vTable2.cell(2,1).Range.Text:='NO.'+myldbh;