| 3°) | Configure as propriedades de cada um doscomponentes seguindo a listagem abaixo: |
| | | Form1: | Left = 262; Top = 142; Width = 350; Height = 370 |
| | | Label1: | Left = 12; Top = 56 |
| | | FileListBox1: | Left = 12; Top = 196; Width = 268; Height = 113; Mask = '*.doc' |
| | | DirectoryListBox1: | Left = 12; Top = 80; Width = 268; Height = 97; DirLabel = Label1 |
| | | DriveComboBox1: | Left = 12; Top = 24; Width = 268; Height = 19; DirList = DirectoryListBox1 |
| | | Button1: | Left = 320; Top = 24; Caption = 'Imprimir' |
| 4°) | No evento onChange do DirectoryListBox1 codifique como exemplificado abaixo: |
| |
| procedure | TForm1.DirectoryListBox1Change(Sender: TObject); | | begin | | | | FileListBox1.Directory := DirectoryListBox1.Directory; | | end; | |
|
| 5°) | Codifique o evento onClick do Button1 comoexemplificado abaixo: |
| |
| procedure | TForm1.Button1Click(Sender: TObject); | | var | | | i: Integer; | | | MyDoc: _Document; | | | MyPath: String; | | | AReadOnly, MyArq, ASave: OleVariant; | | | | begin | | | Printed := False; | | | Asave := False; | | | AReadOnly := True; | | | for | i := 0 toPred(FileListBox1.Items.Count)do | | | begin | | | | | | MyArq := DirectoryListBox1.Directory + FileListBox1.Items[i]; | | | | MyDoc := WordApplication1.Documents.Open(MyArq, EmptyParam, AReadOnly, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam); | | | | WordDocument1.ConnectTo(MyDoc); | | | | WordDocument1.Activate; | | | | WordDocument1.PrintOut; | | | | WordDocument1.Close(ASave); | | | | WordDocument1.Disconnect; | | | | Self.Caption := MyArq; | | | end; | | | | end; | | | |
|
| |
Nenhum comentário:
Postar um comentário