0

If you put a carriage return in a cell of Excel (by pressing Alt + Enter), and save your file as a Text (Tab delimited).txt file, the carriage return does not appear when you open the file in Notepad.

This
is
a
carriage
return

becomes

"Thisisacarriagereturn"

in Notepad.

Why? How is the carriage return being encoded in the text file?

1
  • I believe Notepad needs a carriage return and a line feed. I also think Wordpad does not. Does text file look correct in WordPad?
    – Dan Sp.
    May 4, 2018 at 21:16

1 Answer 1

3

Typing Alt + Enter in a cell results in a Line Feed (LF, ASCII code 10) character, and as such it is also saved to the file.

Here's a copy of your test text in a xls file looked at with a hex editor (0A is hex representation of decimal 10):

00 00 00 19 00 00 54 68 69 73 0A 69 73 0A 61 0A
63 61 72 72 69 61 67 65 0A 72 65 74 75 72 6E FF

Windows Notepad requires a Carriage Return + Line Feed, ASCII codes 13 + 10, to recognize it as a new line

Notepad++ (a freeware text editor) has the ability to recognise any of LF, CR or CR+LF as a new line.

Here's your test copied from Notepad++.

"This is a carriage return"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .