title: How to remove the carriage return from string while pasting content to Excel file
body: <p>I have a problem while pasting my contents (or text) generated by Java code into excel.
  The problem is that my Java code generates a String with multiple lines, i.e. with line breaks (<code>\n</code>) included.  When I try to copy this content and paste it into an Excel file, I am getting a multiline text with a square box symbol.  I came to know that Windows uses <code>\r\n</code> for line breaks and not just <code>\n</code>.  I tried to replace my <code>\n</code> with <code>\r\n</code> and paste the generated text, but I am getting the same square boxes in my Excel file.  Here is my sample code:</p>
  
  <pre><code>      String   myString = "a1\nb1";
        String   tmpString =myString.replace("\n","\r\n");
        System.out.println( "Original = " +"\""+myString+"\"");
        System.out.println( "Result   = " +"\""+tmpString+"\"");
  </code></pre>
  
  <p>I have used the <strong>" "</strong> to wrap the text.  When I tried to paste <strong>tmpstring</strong> in Excel, I got the square box.  How can I remove the boxes with <strong>multiple lines in my cell</strong>?</p>