LoadFromCSV/Multiline

My program inserts rows into a grid with one of the cells being multiline text.  This works okay if I call the AutoSizeRow after each text insert.

The program then writes this same information to a CSV formatted file separated using '|' symbol instead of ','.  I looked in the CSV file and for each record, the multiline cell appears to be the same as what I sent to the grid, ie, each line is separated with a #13 character.

But when I use the LoadFromCSV function, everything is okay but the multiline cells have only one line in them and it appears the others are ignored, or maybe added as blank lines.

So my question is, how do I LoadFromCSV files, multiline cells?

I have retested this here with this sequence:


begin
  advstringgrid1.Cells[1,1] := 'line1'#13#10'line2';
  advstringgrid1.AutoSizeRows(false,0);
  advstringgrid1.SaveToCSV('c:\temp\mlgrid.csv');
  advstringgrid2.LoadFromCSV('c:\temp\mlgrid.csv');
  advstringgrid2.AutoSizeRows(false,0);
end;

and I cannot see a problem. How exactly can we reproduce this?

Following your suggestion, I did a save tocsv and then a loadfromcsv and then used a file byte viewer to look at the csv file.  What I noticed is the $0D at the end of each line in the cell is replaced with a $0B character.  So I adjusted my code to do the same (replace a $0D with $0B) and it almost works.  Now what is happening is the last line of the multiline cell is not loaded, seems to be ignored.

For example:

Before the Save:
  TEST 1
  TEST 2
  TEST 3

After the Load
  TEST 1
  TEST 2

TEST 3 is for some reason is dropped.

I think I am using the latest version of the software, but the compiler is Delphi 2006.  Not sure if that makes any difference.

 I used the byte viewer to look at the CSV file and TEST 3 is there and looks like this:

34 31 32 35 36 2E 38 34 39 |41256.849
39 36 20 7C 20 31 33 2D 44 65 63 2D 32 30 31 32 |96 _ 13-Dec-2012
20 7C 20 32 30 2E 32 33 2E 35 36 20 7C 20 22 54 | _ 20.23.56 _ "T
45 53 54 20 31 0B 54 45 53 54 20 32 0B 54 45 53 |EST 1TEST 2TES
54 20 33 22 0D 0A |T 3"

So you can see TEST 3 is there.  NOTE: the CSV separator is the $7C character

Any ideas?




Could you send the CSV file you created and that causes this problem by email so we can test it here with the latest version of the grid?

Will do .. what email address do I use?

http://www.tmssoftware.com/site/support_mail.asp