1 2 3 4
$word = Win32::OLE->new('Word.Application', 'Quit'); $word->Documents->Open("$WrkDir\\Pruefprotokoll.doc") || die("Unable to open document ", Win32::OLE->LastError()); $word->ActiveDocument->PrintOut; $word->Quit;
1
2
$word->ActiveDocument->MailMerge->OpenDataSource(Name => $csvfile, LinkToSource=>1);
$word->ActiveDocument->MailMerge->Execute(1);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
w.ActiveDocument.MailMerge.MainDocumentType := wdFormLetters;
w.ActiveDocument.MailMerge.OpenDataSource(
Name:=OutputDirEdit.Text+'\Quelle.doc',
ConfirmConversions:=False,
ReadOnly:=False,
LinkToSource:=True,
AddToRecentFiles:=False,
PasswordDocument:='',
PasswordTemplate:='',
WritePasswordDocument:='',
WritePasswordTemplate:='',
Revert:=False,
Format:=wdOpenFormatAuto,
Connection:='',
SQLStatement:='',
SQLStatement1:=''
);
w.ActiveDocument.MailMerge.Destination := wdSendToNewDocument;
w.ActiveDocument.MailMerge.MailAsAttachment := False;
w.ActiveDocument.MailMerge.MailAddressFieldName := '';
w.ActiveDocument.MailMerge.MailSubject := '';
w.ActiveDocument.MailMerge.SuppressBlankLines := True;
w.ActiveDocument.MailMerge.DataSource.FirstRecord := datensatzA;
w.ActiveDocument.MailMerge.DataSource.LastRecord := datensatzE;
w.ActiveDocument.MailMerge.Execute(Pause:=True);