Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> OLE automation problems between Oracle Forms 4.5 & MS Word/Excel 7

OLE automation problems between Oracle Forms 4.5 & MS Word/Excel 7

From: Arsenal do Alfeite <paulo_amaro_at_hotmail.com>
Date: 1997/10/13
Message-ID: <01bcd7f2$65742820$21ec41c2@dif22>#1/1

I'm an ORACLE developer, who is facing some problems with ole automation:       

Goal


   The goal is to get a document (stored as an OLE object in a long raw table column),

   append a signature image (also in a table) and print it.

How to


   Putting OLE automation to work ???

   Invoke methods from an OLE object item to perform some    word/excel functions (as we can do with macros) ?  

   Print a word/excel document stored as an OLE object?  

   Append another object and print it ?

   Or how to save the ole item in a file (of the same format as the object class) ?

Problems


   I have made the package PACK_WORD, but it didn't work out.    The form trigger did execute but the ole server application didn't do anything...   

   Where can I get some more information about this issue ?

I'm using


   RDBMS : Oracle Server 7.1.6.2.0
   Tools : Forms Developer 4.5.7.0.10

             PL/SQL 2.1.6.2.0
   O.S. Server: Windows NT 4.0
   OLE apps: MS Office 95 Pro (Word 7 e Excel 7)



I would appreciate all the possible HEEEELLLP... Thanx

   Paulo Amaro
   e-mail: paulo_amaro_at_hotmail.com    

   from Lisbon, Portugal


Code


PACKAGE pack_word IS

   FUNCTION get_object_handle (ole_item VARCHAR2) RETURN OLE2.OBJ_TYPE;

   PROCEDURE open_doc(ole_item VARCHAR2);

   PROCEDURE save_doc(ole_item VARCHAR2, filename VARCHAR2);

   PROCEDURE print_doc(ole_item VARCHAR2);

END; PACKAGE BODY pack_word IS

   obj_hnd OLE2.OBJ_TYPE;

   FUNCTION get_object_handle (ole_item VARCHAR2) RETURN OLE2.OBJ_TYPE IS    BEGIN

      /*if the server is not active, activate the server 
        and get the object handle */
      if not forms_ole.server_active(ole_item) then
         forms_ole.activate_server(ole_item);
         obj_hnd := forms_ole.get_interface_pointer(ole_item);
      end if;

      return obj_hnd;  

   END;    PROCEDURE save_doc(ole_item VARCHAR2, filename VARCHAR2) IS
      d   OLE2.OBJ_TYPE;
      lst OLE2.LIST_TYPE;
   BEGIN
      d := get_object_handle(ole_item);
    
      lst := ole2.create_arglist;
      ole2.add_arg(lst, filename);

      ole2.invoke(d, 'FileSaveAs',lst);

      ole2.destroy_arglist(lst);
      ole2.release_obj(d);

   END;    PROCEDURE print_doc(ole_item VARCHAR2) IS

      d OLE2.OBJ_TYPE;
   BEGIN
      d := get_object_handle(ole_item);

      ole2.invoke(d, 'FilePrintDefault');

      ole2.release_obj(d);
   END;    PROCEDURE open_doc(ole_item VARCHAR2) IS

      d OLE2.OBJ_TYPE;
      v VARCHAR2(20);
   BEGIN
      d := get_object_handle(ole_item);

      v := forms_ole.find_ole_verb(ole_item,'Open');

      if v > 0 then
         forms_ole.exec_verb(ole_item, 'Open');
      end if;

      ole2.release_obj(d);

   END; END; another unsucessfull example that I tried in a When-button-pressed trigger

DECLARE

      ole_item VARCHAR2(50) := 'BLOCK.ITEM_WORD_OBJ';
      obj_hnd  OLE2.OBJ_TYPE;
BEGIN
      if not forms_ole.server_active(ole_item) then
         forms_ole.activate_server(ole_item);
      end if;

      obj_hnd := forms_ole.get_interface_pointer(ole_item);

      ole2.invoke(obj_hnd, 'Print');

      ole2.release_obj(obj_hnd);

      forms_ole.close_server(ole_item);

END; Received on Mon Oct 13 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US