Decimal and zeros added to text when using DC_Excel2Array

This forum is for eXpress++ general support.
Message
Author
User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Decimal and zeros added to text when using DC_Excel2Array

#1 Post by GeneB »

When converting a spreadsheet to an array using DC_Excel2Array, a column that is fomatted as text but contains only numeric characters has a decimal and many zeros added to every cell in the column.
What is the way to correct this.
This is happening in both build 258 and 260.
Thanks.
GeneB

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Decimal and zeros added to text when using DC_Excel2Arra

#2 Post by Auge_Ohr »

GeneB wrote:When converting a spreadsheet to an array using DC_Excel2Array, a column that is fomatted as text but contains only numeric characters has a decimal and many zeros added to every cell in the column.
What is the way to correct this.
when Excel see "Number" it want to use as Number ... not as String.

so when using DC_Excel2Array() you have to "format" Excel Column to use as String

Code: Select all

oSheet:Columns(i):NumberFormat :=  "@"
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Decimal and zeros added to text when using DC_Excel2Arra

#3 Post by rdonnay »

I'm travelling home early tomorrow.
I'll look into this tomorrow afternoon.
The eXpress train is coming - and it has more cars.

D. Schuster
Posts: 38
Joined: Mon Feb 15, 2010 4:01 am

Re: Decimal and zeros added to text when using DC_Excel2Arra

#4 Post by D. Schuster »

Further remarks can be found under "User Contributions" --> "Importing Excel to DBF"

Dieter

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Decimal and zeros added to text when using DC_Excel2Arra

#5 Post by GeneB »

Thank you, Dieter, but I'm the one that posted that contribution.
What I posted creates a dbf file with the structure you pass and adds data to the dbf file from the spreadsheet regardless of the data type, but this is a different problem.

If the data in the spreadsheet cell is formatted as text data but the data is all numeric characters, DC_Excel2Array() is adding a decimal point and trailing zeros to the original data and putting that in the array as text data. It is the extra characters that are the problem.

I think the solution is a similar 'filter' added to DC_Excel2Array() which I have no doubt Roger will solve with great alacrity.

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Decimal and zeros added to text when using DC_Excel2Arra

#6 Post by GeneB »

Roger,
I wrote my users a 'quick fix' workaround if this is a problem for them, but there is still an exposure for me.
Any progress on this?
Thanks.

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Decimal and zeros added to text when using DC_Excel2Arra

#7 Post by GeneB »

Any thoughts on this?

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Decimal and zeros added to text when using DC_Excel2Arra

#8 Post by rdonnay »

Oops. I forgot about this. I'll work on this next.
The eXpress train is coming - and it has more cars.

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Decimal and zeros added to text when using DC_Excel2Arra

#9 Post by GeneB »

SkeletonOnKeyboard.jpg
SkeletonOnKeyboard.jpg (5.92 KiB) Viewed 15999 times

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Decimal and zeros added to text when using DC_Excel2Arra

#10 Post by GeneB »

[img]s2.jpg[/img]
Attachments
S2.jpg
S2.jpg (5.75 KiB) Viewed 15963 times

Post Reply