I would like to use the clipboard to transfer data from my Java program to Excel. When I put "\"line1\nline2\"\t\"line1\nline2\"" on the clipboard, it is supposed to paste in excel as 2 cells each containing 2 lines.

When I paste in excel however, it will paste \r\n into excel instead of just \n; this will cause excel to show a rectangle (unknown character) at the end of the line.

Appearently on windows, if you insert \n into the clipboard it is translated to \r\n. My question is if there's any way to stop this behaviour, so that if I put \n on the clipboard, it will still be \n when I paste and not \r\n?