I have a script that copies table cells from the browser into the user's clipboard. I loop through each cell and when a new line is needed I use
text += "\n";
If I paste the text into excel, it formats correctly and fills in the proper rows, however if I paste into notepad, it shows a symbol instead of creating a new line:
123□456□789
instead of:
123
456
789
Is there something else I can use that notepad will recognize as a line break?
Your question is not clear but if you mean why "\n" is not visible as text in js then it is because it is newline character i.e it can be used to get an similar effect as html <br> tag.
This character is commonly known as the 'Line Feed' or 'Newline Character'. CR (character : \r, Unicode : U+000D, ASCII : 13, hex : 0x0d) : This is simply the 'r' character. This character is commonly known as 'Carriage Return'.
To create a line break in JavaScript, use “<br>”.
that's because you need a carriage return and line feed.
text += "\r\n";
The non programming way
open up in WordPad
save
open in notepad
You can use the following:
text += "\r\n";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With