Csv Problem!

superbabicka

Member
Licensed User
Hi

I use SaveCSV form table data to excel (txt) csv file.
I have 2 fields cNumber: (for example)
1. Barcode (with value - 8693161008118)
2. CAVT-Number (with value - 4026203334236)

Everything is OK with SaveCSV , but when I open CSV file in excel (2007 Version I have) two cNumber fields have value like this:
1. 8.69316E+12
2. 4.0262E+12

I want to create CSV with original data from my database.sl3.
How to fix this?

There are only two ways for field type cNumber and cString.

:sign0163:
Thanks!
 

agraham

Expert
Licensed User
Longtime User
Everything is OK with SaveCSV , but when I open CSV file in excel (2007 Version I have) two cNumber fields have value like this:
1. 8.69316E+12
2. 4.0262E+12
That looks correct for numeric data imported via a CSV as Excel applies the "General" format to that data. If you double click the cell to edit it in place you will probably see the number as you expected to see it. You will have to apply an appropriate cell "Number" format to display it as you want.
 
Last edited:

superbabicka

Member
Licensed User
HI Erel & Agraham

Yes Erel, when I click on cell in excel, the value is original in Excel (fx) Bar - (same bar like address bar in browsers), but in cell, the value is still the same.



Agraham, As I understand I must use Number Format, no cNumber. It be like:

Table1.AddRow(Format(dr.GetValue(1), ""), dr.GetValue(2)) ...
Here is the line where I add data in table before save CSV.

Are you min like this...?
 

agraham

Expert
Licensed User
Longtime User
Agraham, As I understand I must use Number Format, no cNumber. It be like:

Table1.AddRow(Format(dr.GetValue(1), ""), dr.GetValue(2)) ...
Here is the line where I add data in table before save CSV.

Are you min like this...?
No. It is an Excel display "feature". You need to format the Excel cell with a "Number" format, not the default "General" format.
 

superbabicka

Member
Licensed User
Aha !!!

Aha!

Yes I use that solution, but, another time when I click to generate (actually SaveCSV) from table, the problem has been same. :sign0137:

So when I open CSV First I must select Col and change from General to Number.
Automatically it is impossible a?
 

agraham

Expert
Licensed User
Longtime User
So when I open CSV First I must select Col and change from General to Number. Automatically it is impossible a?
It depends how you want to open the CSV. If you are double clicking it in Windows Explorer then probably not - but if you are manually opening it in Excel with File->Open then you could record or write a VBA macro to open the CSV then format the cells and run that macro to open the file.
 
Top