Я использую формы оракула 10г.Это веб-приложение формы оракула.Я хочу создать отчет Excel из Oracle Forms 10g.Я настроил WEBUTIL и использую пакет CLIENT_OLE2.Процедура объявлена в триггере WHEN-BUTTON-PRESSED.Когда кнопка нажата, вдруг форма зависает, и они ничего не могут сделать.Кнопка выхода и пункты меню перестают работать.Он не выдает никаких сообщений и не выполняет никаких действий.
Код процедуры:
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;