Read content XLS file into my form?

25 pts.
Tags:
Oracle Forms 9i
XLS
I try to read XLS file and fetch it's content to my form specifically in the block item  (:BIN_DOCS.desc_mv_dtl) at runtime when I call this procedure There is no error but when the cursor reach the instruction application := Client_OLE2.create_obj('Excel.Application') the application excel is not running? Any suggestion about this issue? Thank you.
PROCEDURE p90_ IS

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;
worksheet2     Client_OLE2.Obj_Type;
cell           Client_OLE2.OBJ_TYPE;
args           Client_OLE2.OBJ_TYPE;
cell_value     varchar2(100);
num_wrkshts    NUMBER;
wksht_name     VARCHAR2(250);
eod            Boolean := false;
j              integer := 1;
v_fName        VARCHAR2(250);

BEGIN

-- Get the name of the file to open
v_fName :=  'C:Climate_FileBook1.xls';

-- My Way: Use a File Open Dialog to let the user select the file.
v_fName := WebUtil_File.File_Open_Dialog(

directory_name => 'C:Climate_File'

,File_Filter => null

,Title => 'Select Client filename to Open.'

);

-- Make sure the user selected a file
IF ( v_fName IS NOT NULL ) THEN
-- The following sets up communication with the excel spreadsheet
-- --------------------------------------------------------------
-- Open the OLE application

p05_show_alert_message('kabl');
application := Client_OLE2.create_obj('Excel.Application');

p05_show_alert_message('ba3d');

-- Keep the application hidden
Client_OLE2.set_property(application,'Visible','false');
workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
args := Client_OLE2.CREATE_ARGLIST;

-- Open the selected File
-- ----------------------
Client_OLE2.add_arg(args,v_fName);
workbook := Client_OLE2.GET_OBJ_PROPERTY(workbooks,'Open',args);
Client_OLE2.destroy_arglist(args);

worksheets := Client_OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');

-- Get number of worksheets
-- ------------------------
num_wrkshts := Client_OLE2.GET_NUM_PROPERTY(worksheets, 'Count');

worksheet := Client_OLE2.GET_OBJ_PROPERTY(  application,'activesheet');

--Go to the first record
go_block('BIN_DOCS');
first_record;

-- Loop through the Block and create a new row if needed.

loop
If :system.record_status <> 'NEW' then
create_record;
end if;
-- Exit when the last row of the spreadsheet is reached.
exit when eod;

-- Loop through the spreadsheet and get cell values
for k in 1..3 loop  --3 fields per record
-- You have to know fields there are

args:= Client_OLE2.create_arglist;
Client_OLE2.add_arg(args, j);
Client_OLE2.add_arg(args, k);
cell:= Client_OLE2.get_obj_property(worksheet, 'Cells', args);
Client_OLE2.destroy_arglist(args);
cell_value :=Client_OLE2.get_char_property(cell, 'Value');

-- Check for End of Data…
if upper(cell_value) = 'EOD' then
eod:=true;
Message('End of Data');
exit;
end if;

-- Copy the value from Excel to the Forms block item
-- This is how the Oracle example copied values
if k =1 then
:BIN_DOCS.desc_mv_dtl:=cell_value;
end if;

if k =2 then
--:dept.dname:=cell_value;
null;
end if;

if k =3 then
null;
--:dept.loc:=cell_value;
end if;

-- This is my way; which is more efficient and less code
copy(cell_value,name_in('system.cursor_item'));
next_item;
end loop; --for
j:=j+1;
end loop;  --main loop2

-- Release the Client_OLE2 object handles
IF (cell IS NOT NULL) THEN
Client_OLE2.release_obj(cell);
END IF;

IF (worksheet IS NOT NULL) THEN
Client_OLE2.release_obj(worksheet);
END IF;

IF (worksheets IS NOT NULL) THEN
Client_OLE2.release_obj(worksheets);
END IF;

IF (worksheet2 IS NOT NULL) THEN
Client_OLE2.release_obj(worksheet2);
END IF;

IF (workbook IS NOT NULL) THEN
Client_OLE2.release_obj(workbook);
END IF;
IF (workbooks IS NOT NULL) THEN
Client_OLE2.release_obj(workbooks);
END IF;

Client_OLE2.invoke(application,'Quit');
Client_OLE2.release_obj(application);
ELSE
Message('No File selected.');
message(' ');
RAISE Form_Trigger_Failure;
END IF;

END;
software : Forms [32 Bit] Version 9.0.2.9.0 , oracle JInitiator: 1.3.1.9, WebUtil 1.0.2(Beta), window , IE 8

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following