Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    78

    [Delphi] Aggiungere immagine in un documento word

    Ciao a tutti,
    Sto impazzendo!
    Ho bisogno di inserire un'immagine (firma) al fondo di documenti word (office 2003/2007).
    Uso OLEAutomation, ma non riesco a spostarmi al fondo del documento quando il documento ha più pagine

  2. #2
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    78
    Posto un po' di codice (uno dei tanti tentativi)
    codice:
    uses 
       comobj;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var wdgotolast,wdgotopage,wdgotoabsolute : olevariant;
    begin
       Word := CreateOLEObject('Word.Application');
    
       Word.Visible := true;
    
       Word.Documents.Open(GetCurrentDir+'\word.doc');
    
       word.Selection.GoTo(wdGotoPage,wdGoToLast,wdgotoabsolute,EmptyParam);
       word.selection.inlineshapes.addpicture('c:\firma.jpg');
    
       .....
       word.free;
    end;
    L'immagine viene aggiunta in testa al documento e non al fondo.

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    78
    Alfine ho trovato.

    codice:
    uses 
       comobj;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var wdgotolast,wdgotopage,wdgotoabsolute : olevariant;
    begin
       Word := CreateOLEObject('Word.Application');
    
       Word.Visible := true;
    
       Word.Documents.Open(GetCurrentDir+'\word.doc');
    
       word.Selection.EndKey(unit :=wdStory) ; 
    
       word.selection.inlineshapes.addpicture('c:\firma.jpg');
    
       .....
       word.free;
    end;

  4. #4
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    78
    Scusate, nel post precedente ho dimenticato una libreria:

    codice:
    uses 
       comobj,word2000;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var wdgotolast,wdgotopage,wdgotoabsolute : olevariant;
    begin
       Word := CreateOLEObject('Word.Application');
    
       Word.Visible := true;
    
       Word.Documents.Open(GetCurrentDir+'\word.doc');
    
       word.Selection.GoTo(wdGotoPage,wdGoToLast,wdgotoabsolute,EmptyParam);
       word.selection.inlineshapes.addpicture('c:\firma.jpg');
    
       .....
       word.free;
    end;

  5. #5
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    78
    Invece di word.free usare--->> word := unassigned

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.