Essentially, a hard return to Excel (shift + enter or alt + enter, I donβt remember) puts a new line equivalent to \ x0A in the default encoding, which I use to write my CSV. When I write to CSV, I use StreamWriter.WriteLine (), which prints a line plus a new line (I believe this is \ r \ n).
The CSV is fine and it comes out exactly how Excel saves it, the problem is when I read it in an empty device to delete records, I use ReadLine (), which will process the record with an inline new line as CRLF.
Here is an example file after converting to CSV ...
Reference,Name of Individual or Entity,Type,Name Type,Date of Birth,Place of Birth,Citizenship,Address,Additional Information,Listing Information,Control Date,Committees 1050,"Aziz Salih al-Numan ",Individual,Primary Name,1941 or 1945,An Nasiriyah,Iraqi,,Ba'th Party Regional Command Chairman; Former Governor of Karbala and An Najaf Former Minister of Agriculture and Agrarian Reform (1986-1987),Resolution 1483 (2003),6/27/2003,1518 (Iraq) 1050a,???? ???? ???????,Individual,Original script,1941 or 1945,An Nasiriyah,Iraqi,,Ba'th Party Regional Command Chairman; Former Governor of Karbala and An Najaf Former Minister of Agriculture and Agrarian Reform (1986-1987),Resolution 1483 (2003),6/27/2003,1518 (Iraq)
As you can see, the first entry has an inline new line after al-Numan. When I use ReadLine (), I get "1050", "Aziz Salih al-Numan", and when I write this, WriteLine () ends this CRLF line. I am losing the original string terminator. When I use ReadLine () again, I get a line starting with '1050a'.
I could read the whole file and replace it, but then I would have to replace them. Basically, what I want to do is get the line terminator to determine if it is \ x0a or CRLF, and then if its \ x0A, I will use Write () and insert this terminator.