Hi,
I tried it with the file you sent me and the code:
begin
xls := TXlsFile.Create( true);
try
Win1252Encoding := TEncoding.GetEncoding(1252);
try
Xls.Open('r:\cda-export.csv', TFileFormats.Text, ';', 1, 1, nil, Win1252Encoding, true);
xls.Save('r:\test.xlsx');
finally
Win1252Encoding.Free;
end;
finally
xls.Free;
end;
end;
And the file seems correct. Values in column x seem ok, for example X11 is 861.99 in both the CSV and the file created by FlexCel.
The column that isn't correct with the code above is for example column BI. So for example BI11 is
"Entreprise de pompes funèbres (à concurrence du montant de la facture)"
But this is because the file is not in Win32, but UTF-8.
With this code:
begin
xls := TXlsFile.Create( true);
try
UTF8Encoding := TEncoding.UTF8;
try
Xls.Open('r:\cda-export.csv', TFileFormats.Text, ';', 1, 1, nil, UTF8Encoding, true);
xls.Save('r:\test.xlsx');
finally
//Don't free built-in encodings. You only have to free those created with GetEncoding;
end;
finally
xls.Free;
end;
end;
The file seems ok. The only thing I can think is that you have different decimal separators from the file, so FlexCel is considering 861.99 as 86199 (as if the . was a thousands separator).
If that is the problem you are seeing, you need to tell FlexCel which decimal separator the file uses.
You can do that with Push/PopThreadFormat, as explained here:
If it is a different problem, let me know what you see in column X.