Home » Developer & Programmer » Forms » Oracle Form freezes after configure WEBUTIL
Oracle Form freezes after configure WEBUTIL [message #673543] Fri, 23 November 2018 05:39
rehmankhan
Messages: 22
Registered: July 2018
Junior Member
I am using oracle forms 10g. It is web based oracle form application. I want to generate Excel Report from Oracle Forms 10g. I configured WEBUTIL and use CLIENT_OLE2 package. Procedure declared in trigger WHEN-BUTTON-PRESSED. When button pressed then suddenly the form freezes and they cannot do anything. Exit button and menu options stops working. It does not give any message and does not do any action also


declare
     application client_ole2.obj_type;
     workbooks client_ole2.obj_type;
     workbook client_ole2.obj_type;
     worksheets client_ole2.obj_type;
     worksheet client_ole2.obj_type;
     cell client_ole2.obj_type;
     arglist client_ole2.list_type;
     row_num number;
     col_num number;
     fontObj client_ole2.obj_type;

    cursor rec is SELECT so.descr saleorgdescr,ih.invdate invdatemaster, ih.docNUM docnum,
       TO_CHAR(ih.invdate,'mon-yyyy') invmonth
    FROM ARMINVHEAD ih, SDMSALEORG so
    WHERE
    ih.status='69'
    AND  TO_DATE(ih.INVDATE,'DD-MM-RRRR')
    BETWEEN
                       TO_DATE('01-01-2008','DD-MM-RRRR') 
                  AND  
                       TO_DATE('01-01-2009','DD-MM-RRRR')
    order by IH.INVDATE, ih.docnum;

    procedure SetCellValue(rowid number,colid number,cellValue varchar) is
     begin
     arglist := client_ole2.create_arglist;
     client_ole2.add_arg(arglist,rowid);
     client_ole2.add_arg(arglist,colid);
     cell:= client_ole2.get_obj_property(worksheet,'Cells',arglist);
     fontObj := client_ole2.get_obj_property(cell,'Font');
     client_ole2.destroy_arglist(arglist);
     client_ole2.set_property(cell,'value',cellValue);
     client_ole2.set_property(fontObj,'Size',16);
     client_ole2.set_property(fontObj,'BOLD',1);
     client_ole2.set_property(fontObj,'ColorIndex',7);
     client_ole2.release_obj(cell);
    end SetCellValue;
 
    procedure app_init is
     begin
     application := client_ole2.create_obj('Excel.Application');
     client_ole2.set_property(application,'Visible',true);
     workbooks := client_ole2.get_obj_property(application,'workbooks');
     workbook := client_ole2.Get_Obj_Property(workbooks,'add');
     worksheets := client_ole2.get_obj_property(application,'worksheets');
     worksheet := client_ole2.Get_Obj_Property(worksheets,'add');
     client_ole2.set_property(worksheet,'Name','Emp Sheet');
    end app_init;
 
    procedure save_excel(path varchar,filename varchar) is
     begin
     client_OLE2.Release_Obj(worksheet);
     client_OLE2.Release_Obj(worksheets);
     -- Save the Excel file created
     If path is not null then
       Arglist := client_OLE2.Create_Arglist;
       client_OLE2.Add_Arg(Arglist,path||'\'||file_name||'.xls');
       client_OLE2.Invoke(workbook, 'SaveAs', Arglist);
       client_OLE2.Destroy_Arglist(Arglist);
    end if;
    end save_excel;

    begin
     app_init;
     row_num:=1;
     col_num:=1;
     SetCellValue(row_num,col_num,'saleorgdescr');
     col_num:=col_num + 1;
     SetCellValue(row_num,col_num,'invdatemaster');
     col_num:=col_num + 1;
     SetCellValue(row_num,col_num,'docnum');
     col_num:=col_num + 1;
     SetCellValue(row_num,col_num,'invmonth');
     for i in rec loop
     row_num:=row_num + 1;
     col_num:=1;
     SetCellValue(row_num,col_num,i.saleorgdescr);    
     col_num:=2;
     SetCellValue(row_num,col_num,i.invdatemaster);    
     col_num:=3;
     SetCellValue(row_num,col_num,i.docnum);
     col_num:=4;
     SetCellValue(row_num,col_num,i.invmonth);   
    end loop;    
    save_excel('C:','emp_data');       
    client_OLE2.Release_Obj(workbook);
    client_OLE2.Release_Obj(workbooks);
    client_OLE2.Release_Obj(application);
    end;

Previous Topic: uploading an image in 10g
Next Topic: Creating dynamic table based on Excel data
Goto Forum:
  


Current Time: Sun Apr 05 06:08:45 CDT 2020