Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
Delphi 7 Enterprise
|
Re: Hilfe bei Word und Ole (Briefkopf)
29. Jun 2005, 01:25
Moin,
versuch doch mal folgendes
Delphi-Quellcode:
uses OleServer, WordXP;
procedure TForm.ButtonClick(Sender: TObject);
var WordApplication:TWordApplication;
type_:variant;
begin
WordApplication:=TWordApplication.Create(Self);
try
WordApplication.Connect;
WordApplication.Visible:=true;
WordApplication.Documents.Add(EmptyParam, EmptyParam, EmptyParam, EmptyParam);
if WordApplication.ActiveWindow.View.SplitSpecial <> 0 then
WordApplication.ActiveWindow.Panes.Item(2).Close;
type_:=WordApplication.ActiveWindow.ActivePane.View.type_;
if INTEGER(type_) in [1, 2, 3] then
WordApplication.ActiveWindow.ActivePane.View.type_ := 3;
WordApplication.ActiveWindow.ActivePane.View.SeekView := 9;
WordApplication.Selection.Font.Name := 'Arial';
WordApplication.Selection.Font.Size := 12;
WordApplication.Selection.Font.Bold := 1;
WordApplication.Selection.ParagraphFormat.Alignment := 1;
WordApplication.Selection.TypeText('Mustername - Musterstrasse 433 - 34223 Musterhausen');
if WordApplication.Selection.HeaderFooter.IsHeader then
WordApplication.ActiveWindow.ActivePane.View.SeekView := 10
else
WordApplication.ActiveWindow.ActivePane.View.SeekView := 9;
WordApplication.Selection.TypeText('Bankverbindung sollte hier stehen');
WordApplication.ActiveWindow.ActivePane.View.SeekView := 0;
WordApplication.Selection.TypeText(DBEdit2.Text + ' ' + DBEdit1.Text);
WordApplication.Selection.TypeParagraph;
WordApplication.Selection.TypeText(DBEdit3.Text + ' ' + DBEdit4.Text);
WordApplication.Selection.TypeParagraph;
WordApplication.Selection.TypeParagraph;
WordApplication.selection.Font.Name := 'Arial';
WordApplication.Selection.Font.Size := 12;
WordApplication.Selection.Font.Bold := 1;
WordApplication.Selection.TypeText(DBEdit5.Text + ' ' + DBEdit6.Text);
WordApplication.Selection.TypeParagraph;
WordApplication.Selection.TypeParagraph;
WordApplication.Selection.TypeParagraph;
WordApplication.Selection.TypeParagraph;
WordApplication.selection.Font.Name := 'Arial';
WordApplication.Selection.Font.Size := 12;
WordApplication.Selection.Font.Bold := 1;
WordApplication.Selection.TypeText('Betreff: ');
WordApplication.Selection.TypeParagraph;
WordApplication.Selection.TypeParagraph;
WordApplication.Selection.TypeParagraph;
WordApplication.selection.Font.Name := 'Arial';
WordApplication.Selection.Font.Size := 12;
WordApplication.Selection.Font.Bold := 1;
WordApplication.Selection.TypeText('Sehr geehrte Damen und Herren,');
finally
WordApplication.Disconnect;
WordApplication.free;
end;
end;
MfG
Thorsten
|
|
Zitat
|