Harbour TOleAuto():New() 1 will read as 1.00
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
Harbour TOleAuto():New() 1 will read as 1.00
Hi,
excel file, cell type normal .
itemid qty
001 1
002 1
010 8
oExcel := TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Open(ALLTRIM(cfile))
oSheet := oExcel:ActiveSheet()
? oSheet:Cells(2,1):Value
//1.00
? oSheet:Cells(2,1):Value
//2.00
? oSheet:Cells(3,1):Value
//10.00
Best regards!
Shuming Wang
excel file, cell type normal .
itemid qty
001 1
002 1
010 8
oExcel := TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Open(ALLTRIM(cfile))
oSheet := oExcel:ActiveSheet()
? oSheet:Cells(2,1):Value
//1.00
? oSheet:Cells(2,1):Value
//2.00
? oSheet:Cells(3,1):Value
//10.00
Best regards!
Shuming Wang
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
ShumingWang
If I understand you correctly .. you are looking to 'format' a column ?? If so you can uses the following :
For alpha\numeric column :
oSheet:Range( "A:C" ):Set( "NumberFormat", '@' )
For a numeric column with 2 decimals:
oSheet:Range( "A:C" ):Set( "NumberFormat", '0.00' )
The formatting comes after you define your workbook.
Hope this helps
Rick Lipkin
If I understand you correctly .. you are looking to 'format' a column ?? If so you can uses the following :
For alpha\numeric column :
oSheet:Range( "A:C" ):Set( "NumberFormat", '@' )
For a numeric column with 2 decimals:
oSheet:Range( "A:C" ):Set( "NumberFormat", '0.00' )
The formatting comes after you define your workbook.
Hope this helps
Rick Lipkin
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Mr Richard
That is not what he wants. Even I misunderstood him earlier. What he says is this.
He is reading from excel sheet using TOleAuto. He is reading second column. All the numbers in the second column in the excel sheet are integers.
After harbour reads these integers, Harbour shows these intergers as 1.00, 2.00, etc. but not as 1, 2, etc. He says why can not Harbour show them as 1, 2, etc.
That is not what he wants. Even I misunderstood him earlier. What he says is this.
He is reading from excel sheet using TOleAuto. He is reading second column. All the numbers in the second column in the excel sheet are integers.
After harbour reads these integers, Harbour shows these intergers as 1.00, 2.00, etc. but not as 1, 2, etc. He says why can not Harbour show them as 1, 2, etc.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
Thank you all for take interested to this!
Some time a table with a field named itemid char type might load some data from an excel sheet.
read from excel seet:
itemid qty
001 1
002 1
003 2
004 2.11
011 18.10
--->
to database table1
wanted result :
itemid(char) qty (float)
001 1.00
002 1.00
003 2.00
004 2.11
011 18.10
But actual wrong result:
itemid(char) qty (float)
1.00 1.00
2.00 1.00
3.00 2.00
4.00 2.11
11.00 18.10
Sorry ,I posted to http://lists.harbour-project.org/piperm ... /date.html , but failed.
Best regard!
Shuming Wang
Some time a table with a field named itemid char type might load some data from an excel sheet.
read from excel seet:
itemid qty
001 1
002 1
003 2
004 2.11
011 18.10
--->
to database table1
wanted result :
itemid(char) qty (float)
001 1.00
002 1.00
003 2.00
004 2.11
011 18.10
But actual wrong result:
itemid(char) qty (float)
1.00 1.00
2.00 1.00
3.00 2.00
4.00 2.11
11.00 18.10
Sorry ,I posted to http://lists.harbour-project.org/piperm ... /date.html , but failed.
Best regard!
Shuming Wang