Home » Developer & Programmer » Forms » Problem reading DATEs from Excel via OLE2 (Oracle Forms 6i)
Problem reading DATEs from Excel via OLE2 [message #287563] Wed, 12 December 2007 12:33 Go to next message
mtm1701
Messages: 2
Registered: December 2007
Location: Long Island, NY
Junior Member
We have a legacy 6i form which use OLE2 to upload data from excel into the form, which it does flawlessly.

I need to modify the form to read a new DATE column and I am running into problems.

Heretofore, to read numeric and character cells I used the following (respectively) within a loop that went through each cell on each row of the spreadsheet:

cell_value_num := ole2.get_num_property (cell, 'Value');
cell_value_char := ole2.get_char_property(cell, 'Value');

where cell_value_num is defined as NUMBER and cell_value_char is defined as varchar2(4000).

The test spreadsheet has 2 rows.
The date columns in excel have the values 12/25/2007 for row 1 and 2/27/2007 for row 2.

When I use
"cell_value_char := ole2.get_char_property(cell, 'Value');"
to read the cell, CELL_VALUE_CHAR is "1", not "12/25/2007". Similarly, reading 2/27/2007 yields "2" instead of "2/27/2007".

Even if the column is defined in Excel as TEXT, I still only gets only the first character.

If the dates in the spreadsheet are enclosed in single-quotes (e.g. '12/25/2007') then it works perfectly, but I do not want to require the users to do that.

Any insights??
Thanks
Re: Problem reading DATEs from Excel via OLE2 [message #287714 is a reply to message #287563] Thu, 13 December 2007 04:20 Go to previous messageGo to next message
scorpio_biker
Messages: 154
Registered: November 2005
Location: Kent, England
Senior Member
I've not done anything like this myself so this is a bit of a 'clutching at straws' post, but in this post uploading data they use this syntax
e_rec.oa_date:= to_date(OLE2.GET_CHAR_PROPERTY(MyCell, 'Text' ),'DD-MON-RRRR');


It might help?
Re: Problem reading DATEs from Excel via OLE2 [message #287794 is a reply to message #287714] Thu, 13 December 2007 08:37 Go to previous message
mtm1701
Messages: 2
Registered: December 2007
Location: Long Island, NY
Junior Member
Smile

Perfect.
Thank You!!!!
Previous Topic: Trigger Assistance
Next Topic: how to connect all data base tables to oracle forms
Goto Forum:
  


Current Time: Mon Feb 03 00:58:46 CST 2025