Page 1 of 4

Decimal and zeros added to text when using DC_Excel2Array

Posted: Mon Jan 19, 2015 4:59 pm
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

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Mon Jan 19, 2015 7:01 pm
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 :=  "@"

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Mon Jan 19, 2015 8:44 pm
by rdonnay
I'm travelling home early tomorrow.
I'll look into this tomorrow afternoon.

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Tue Jan 20, 2015 3:46 am
by D. Schuster
Further remarks can be found under "User Contributions" --> "Importing Excel to DBF"

Dieter

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Tue Jan 20, 2015 10:19 am
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.

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Tue Jan 27, 2015 11:48 am
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.

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Thu Feb 05, 2015 8:23 pm
by GeneB
Any thoughts on this?

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Fri Feb 06, 2015 7:22 am
by rdonnay
Oops. I forgot about this. I'll work on this next.

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Sat Feb 07, 2015 4:12 pm
by GeneB
SkeletonOnKeyboard.jpg
SkeletonOnKeyboard.jpg (5.92 KiB) Viewed 16602 times

Re: Decimal and zeros added to text when using DC_Excel2Arra

Posted: Fri Feb 13, 2015 5:44 pm
by GeneB
[img]s2.jpg[/img]