I use forms 6i and oracle 8i....
I have to read a range of value from excel.
I use ole2 and I can read one value at time, but on the help
I found :
DECLARE
Range OleVar;
Value OleVar;
BEGIN
/* Find the range of cells you want to interact with */
Range := Excel_Worksheet.Ole_Range(
:excel.interface,
To_Variant(excel_range_spec));
/* Get the value of cells in the range excel_range_spec */
Value := Excel_Range.Value(Var_tbj(Range));
/* Populate PL/SQL table with values from Microsoft Excel Worksheet */
Var_to_Table(Value,tablename);
END;
but the EXCEL_WORKSHEET.OLE_RANGE give me error...I need a package or enything else?
HeLP help help
I had used:
-- Declare handles to OLE objects
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
-- Declare handles to OLE argument lists
args ole2.list_type;
Check_file text_io.file_type;
no_file exception;
--PRAGMA exception_INIT (no_file, -302000);
cell_value varchar2(2000);
BEGIN
-- Check the file can be found, if not exception no_file will be raised
Check_file := TEXT_IO.FOPEN('C:\listino.xls','R');
TEXT_IO.FCLOSE(Check_file);
application:= ole2.create_obj('Excel.Application');
workbooks := ole2.get_obj_property(application, 'Workbooks');
-- Open the required workbook
args:= ole2.create_arglist;
ole2.add_arg(args, 'C:\listino.xls');
workbook := ole2.invoke_obj(workbooks, 'Open', args);
ole2.destroy_arglist(args);
-- Open worksheet Sheet1 of that Workbook
args:= ole2.create_arglist;
ole2.add_arg(args, 'articoli e listini');
worksheet := ole2.get_obj_property(workbook, 'Worksheets', args);
ole2.destroy_arglist(args);
-- Get value of cell A2 of worksheet Sheet1
args:= ole2.create_arglist;
ole2.add_arg(args, 2);--2
ole2.add_arg(args, 1);--A
cell:= ole2.get_obj_property(worksheet, 'Cells', args);
ole2.destroy_arglist(args);
cell_value :=ole2.get_char_property(cell, 'Value');
messaggio('Alert_error',cell_value);
ole2.invoke(application,'Quit');
message('Chiuso');
-- Release the OLE2 object handles
ole2.release_obj(cell);
ole2.release_obj(worksheet);
ole2.release_obj(workbook);
ole2.release_obj(workbooks);
ole2.release_obj(application);
message('Hi am in safer side');
exception
WHEN no_file THEN
MESSAGE('file not found.');
WHEN OTHERS THEN
message('errore.');
END;
help help help me please
I have to read a range of value from excel.
I use ole2 and I can read one value at time, but on the help
I found :
DECLARE
Range OleVar;
Value OleVar;
BEGIN
/* Find the range of cells you want to interact with */
Range := Excel_Worksheet.Ole_Range(
:excel.interface,
To_Variant(excel_range_spec));
/* Get the value of cells in the range excel_range_spec */
Value := Excel_Range.Value(Var_tbj(Range));
/* Populate PL/SQL table with values from Microsoft Excel Worksheet */
Var_to_Table(Value,tablename);
END;
but the EXCEL_WORKSHEET.OLE_RANGE give me error...I need a package or enything else?
HeLP help help
I had used:
-- Declare handles to OLE objects
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
-- Declare handles to OLE argument lists
args ole2.list_type;
Check_file text_io.file_type;
no_file exception;
--PRAGMA exception_INIT (no_file, -302000);
cell_value varchar2(2000);
BEGIN
-- Check the file can be found, if not exception no_file will be raised
Check_file := TEXT_IO.FOPEN('C:\listino.xls','R');
TEXT_IO.FCLOSE(Check_file);
application:= ole2.create_obj('Excel.Application');
workbooks := ole2.get_obj_property(application, 'Workbooks');
-- Open the required workbook
args:= ole2.create_arglist;
ole2.add_arg(args, 'C:\listino.xls');
workbook := ole2.invoke_obj(workbooks, 'Open', args);
ole2.destroy_arglist(args);
-- Open worksheet Sheet1 of that Workbook
args:= ole2.create_arglist;
ole2.add_arg(args, 'articoli e listini');
worksheet := ole2.get_obj_property(workbook, 'Worksheets', args);
ole2.destroy_arglist(args);
-- Get value of cell A2 of worksheet Sheet1
args:= ole2.create_arglist;
ole2.add_arg(args, 2);--2
ole2.add_arg(args, 1);--A
cell:= ole2.get_obj_property(worksheet, 'Cells', args);
ole2.destroy_arglist(args);
cell_value :=ole2.get_char_property(cell, 'Value');
messaggio('Alert_error',cell_value);
ole2.invoke(application,'Quit');
message('Chiuso');
-- Release the OLE2 object handles
ole2.release_obj(cell);
ole2.release_obj(worksheet);
ole2.release_obj(workbook);
ole2.release_obj(workbooks);
ole2.release_obj(application);
message('Hi am in safer side');
exception
WHEN no_file THEN
MESSAGE('file not found.');
WHEN OTHERS THEN
message('errore.');
END;
help help help me please