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?

  • 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 '18 at 21:16
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"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.