TTMSFNCDataGrid.LoadFromCSVData preventing column trimming

Hi!
I'm starting with the FNCDataGrid and trying to figure things out.
I load a csv file.
One of the columns consists of data like " Z 1" and "ZZZG".
When I import the file, the field is trimmed and the leading space is gone.
" Z 1" resolves to "Z 1".
Can I prevent that?

leading & trailing spaces are removed when the value doesn't contain double quotes. So, if you can manipulate the CSV, add double quotes around the text you want spaces to be preserved for example

Col1;Col2;Col3
" Z1";"ZZZG";"ABC"

If that's not sufficient, we'll investigate if we can add an option to control space trimming.

Thanks for the quick answer!
Sadly I have no control over the structure of the file. It is exported by a SAP system.
And I don't want to build in another level of data manipulation my customers would have to maintain in the long run.
For now I found a workaround in my project, but if you could build in such an option (default on trimming would fit for most users I think) in the future I would be very happy, since I'm really liking what I have seen of FNCDataGrid and planning to use it quite often in the future.
Nice work!

Hi,

We have changed the behavior and respected spaces while importing CSV data. Next version will address this. Additionally, since the behavior has changed, we've added a new property Options.IO.TrimSpaces, which is False by default. setting it true will result in the behavior you are seeing now. Note that double-quotes around the text will still import the text with spaces regardless of Options.IO.TrimSpaces.

Next version is planned for Wednesday next week.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.