Home » Developer & Programmer » Forms » Export to an pre-existing Excel file (forms 6i)
Export to an pre-existing Excel file [message #399125] Mon, 20 April 2009 16:44 Go to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

Hello all,

I am using forms 6i, and I need to export some calculations from a form to an already existing Excel file(basically used to update this excel file based on the calcs). I read something about using DDE package, will this work? am I on the right track, are there any more examples I can use?
Re: Export to an pre-existing Excel file [message #399158 is a reply to message #399125] Mon, 20 April 2009 23:21 Go to previous messageGo to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Search for ole2

http://www.orafaq.com/forum/m/394167/98792/#msg_394167

kanish
Re: Export to an pre-existing Excel file [message #399299 is a reply to message #399125] Tue, 21 April 2009 08:41 Go to previous messageGo to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

thanks,

Based on the examples, how do you call a specific Excel spreadsheet?
application := ole2.create_obj('Excel.Application');
ole2.set_property(application,'Visible','True');
workbooks := ole2.get_obj_property
(application,'Workbooks');
workbook := ole2.invoke_obj(workbooks,'Add');
worksheets := ole2.get_obj_property
(workbook,'Worksheets');
worksheet := ole2.invoke_obj(worksheets,'Add');
Re: Export to an pre-existing Excel file [message #399306 is a reply to message #399299] Tue, 21 April 2009 09:34 Go to previous message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

I decided to use DDE package, it works to the point that it opens the pre-existing excel file, but my data is not going in the correct columns and rows any ideas on how to fix this?


DECLARE
  appid   PLS_INTEGER;
  convid  PLS_INTEGER;
  x       NUMBER := 2;
  c	  NUMBER := 4;
  rowcol  VARCHAR2(30);
  v_row	  VARCHAR2(10);
  
BEGIN
	
appid :=     
    dde.app_begin('c:\program files\microsoft office\office11\excel.exe c:\forms6i\test_file.xls',dde.app_mode_normal);

convid := dde.initiate('EXCEL','c:\forms6i\TEST_FILE.xls');
	
	
LOOP
    
    /* Put contents of form field var into Row 3 Column A */
        v_row := 'R'||TO_CHAR(x);
        rowcol := v_row||'C'||TO_CHAR(c);
        dde.poke(convid,rowcol,:control.item4,dde.cf_text,1000);
        
	        x := x + 1; 
	        c:=  c + 1;
	        exit when x > 17;  
	        
	        next_record;
END LOOP;

    /*  close EXCEL and clean up*/
dde.terminate(convid);
Previous Topic: error capture
Next Topic: Right click on Hierarchical tree
Goto Forum:
  


Current Time: Sun Dec 04 10:36:29 CST 2016

Total time taken to generate the page: 0.07978 seconds