Forms OLE EXCEL

From: Peder Strauss <peder.strauss_at_crm.se>
Date: 1998/01/07
Message-ID: <34B2BAB8.17B13588_at_crm.se>#1/1


I have the following problem i want to open a text file into a Excel workbook thats embedded in a Forms 4.5 or 5.0 form.
I can do what i want with Excel, acitvate from the app (not get the pointer of the embedded object).
Ex..
PROCEDURE openxls(filenanme varchar2,objectamne varchar2) IS application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheets ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
lst ole2.list_type;
lst2 ole2.list_type;

BEGIN
application :=ole2.create_obj('Excel.Application.8'); ole2.set_property(application ,'Visible','True');

  lst := ole2.create_arglist;
  ole2.add_arg(lst,'d:\Data\List\koder.lis');
-- Origin:=xlWindows = constant ??

  ole2.add_arg(lst,2);
--StartRow:=1 = constant ??

  ole2.add_arg(lst,1);
--DataType:=xlDelimited = constant ??

  ole2.add_arg(lst,1);
--TextQualifier:=xlDoubleQuote = constant ??
  ole2.add_arg(lst,1);
--ConsecutiveDelimiter:=False= 0

  ole2.add_arg(lst,0);
--Tab:=True= 1

  ole2.add_arg(lst,1);
--TSemicolon:=True= 1

  ole2.add_arg(lst,1);
--Comma:=False= 0

  ole2.add_arg(lst,0);
--space:=False= 0

  ole2.add_arg(lst,0);
--Other:=False= 0

  ole2.add_arg(lst,0);
  Workbooks:=ole2.get_obj_property(application,'Workbooks');   ole2.invoke(Workbooks,'OpenText',lst); --Works fine END; I can manipulate the existing worksheet thats embedded (as insert object ..create from file) in the Form with the following. Ex..

begin
if id_null(item_id) then
 message('No such item: '||item_name);
else

    active_server := Forms_OLE.Server_Active(item_id);

     IF active_server = FALSE THEN
        forms_ole.activate_server(item_id);
     END IF;

 obj_hnd := FORMS_OLE.Get_Interface_Pointer(item_id); end if;
Worksheets:=ole2.get_obj_property(obj_hnd,'Worksheets'); --I have the pointer to the worksheets object
Worksheet:= ole2.invoke_obj(Worksheets ,'Add'); lst2 := ole2.create_arglist;
ole2.add_arg(lst2,2);
ole2.add_arg(lst2,2);
/* Call the Cells method to get a handle to the

   specified cell.
*/
cell := ole2.GET_OBJ_PROPERTY(Worksheet,'Cells',lst2); * Set the value of that cell. */
value :='Donald';
ole2.set_property(cell,'Value',value ); --Works fine

end;

The problem ???
How do i get the pointer to a workbooks object from the embedded Excel object since it is a worksheets object.
Can I do this call ole2.invoke(Workbooks,'OpenText',lst); directly in forms.

Can someone help me on this:
Thanks a lot.
Peder Received on Wed Jan 07 1998 - 00:00:00 CET

Original text of this message