Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения
KANSoftWare

Автоматизация Word с OLE

Delphi , Технологии , OLE Automation MSOffice

Автоматизация Word с OLE

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

uses
   comobj;

 procedure TForm1.Button1Click(Sender: TObject);
 var
   Word: OLEVariant;
 begin
   try
     Word := CreateOleObject('Word.Application');
   except
     ShowMessage('Cannot start Word !');
     Exit;
   end;
   // Show Word 
  Word.Visible := True;
   // Add a new Document 
  Word.Documents.Add;
   if Word.ActiveWindow.View.SplitSpecial <> 0 then
     Word.ActiveWindow.Panes[2].Close;
   if (Word.ActiveWindow.ActivePane.View.type = 1) or
     (Word.ActiveWindow.ActivePane.View.type = 2) or
     (Word.ActiveWindow.ActivePane.View.type = 5) then
     Word.ActiveWindow.ActivePane.View.type := 3;
   Word.ActiveWindow.ActivePane.View.SeekView := 9;

   Word.Selection.Font.Name     := 'Times New Roman';
   Word.Selection.Font.Size     := 12;
   Word.Selection.Font.Bold     := True;
   Word.Selection.ParagraphFormat.Alignment := 1;
   Word.Selection.TypeText(Text :=
     'Kohlenhandel Brikett-GmbH & Co.-KG. - Holzweg 16 - 54633 Steinhausen');

   if Word.Selection.HeaderFooter.IsHeader = True then
     Word.ActiveWindow.ActivePane.View.SeekView := 10
   else
     Word.ActiveWindow.ActivePane.View.SeekView := 9;
   Word.Selection.TypeText(Text :=
     'Bankverbindung: Stadtsparkasse Steinhausen BLZ 123456789   KtoNr. 782972393243');
   Word.ActiveWindow.ActivePane.View.SeekView := 0;
   Word.Selection.TypeText(Text := Edit2.Text + ' ' + edit1.Text);
   Word.Selection.TypeParagraph;
   Word.Selection.TypeText(Text := edit3.Text);
   Word.Selection.TypeParagraph;
   Word.Selection.TypeParagraph;
   Word.Selection.Font.Name := 'Times New Roman';
   Word.Selection.Font.Size := 12;
   Word.Selection.Font.Bold := True;

   Word.Selection.TypeText(Text := edit4.Text + ' ' + edit5.Text);
   Word.Selection.TypeParagraph;
   Word.Selection.TypeParagraph;
   Word.Selection.TypeParagraph;
   Word.Selection.TypeParagraph;
   Word.Selection.Font.Name     := 'Arial';
   Word.Selection.Font.Size     := 14;
   Word.Selection.Font.Bold     := True;
   Word.Selection.TypeText(Text := Combobox1.Text);
   Word.Selection.TypeParagraph;
   Word.Selection.TypeParagraph;
   Word.Selection.TypeParagraph;
   Word.Selection.Font.Name := 'Times New Roman';
   Word.Selection.Font.Size := 12;
   Word.Selection.Font.Bold := True;
   if radiogroup1.ItemIndex = 0 then
     Word.Selection.TypeText(Text := 'Sehr geehrter Herr ' + edit1.Text)
   else
     Word.Selection.TypeText(Text := 'Sehr geehrte Frau ' + edit1.Text);
 end;

Статья Автоматизация Word с OLE раздела Технологии OLE Automation MSOffice может быть полезна для разработчиков на Delphi и FreePascal.


Комментарии и вопросы


Ваше мнение или вопрос к статье в виде простого текста (Tag <a href=... Disabled). Все комментарии модерируются, модератор оставляет за собой право удалить непонравившейся ему комментарий.

заголовок

e-mail

Ваше имя

Сообщение

Введите код




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: OLE Automation MSOffice ::


реклама



©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru Rambler's Top100
16.04.2024 14:56:10/0.033627986907959/0