Home  >  Q&A  >  body text

When Java exports CSV, it is required to wrap lines without formatting.

The following data is output to a CSV cell: only line breaks in this cell

strKey = "\""+"w3444444444444445\n234444444444"+"\"";

而不是像图中换到了另一行

It won’t work if you change it to r or rn

滿天的星座滿天的星座2712 days ago547

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-05-17 10:10:06

    Is this still in CSV format?

    reply
    0
  • 迷茫

    迷茫2017-05-17 10:10:06

    FileWriter writer = new FileWriter(file);
    writer.write("1,2,3,4\n\"5\nw\",6,7,8");
    writer.close();

    I tried it, and it’s ok if I write it like this. Just make sure that the content to be wrapped is enclosed in double quotes

    reply
    0
  • Cancelreply