![](/img/trans.png)
[英]Display complete jtextarea content into single cell of excel file during export.
[英]How to save complete data of JTextArea in to single cell of csv file
我将JTextArea数据保存到csv文件中,但是应用程序未将整个数据保存在单个单元格中。
例如:在JTextArea中,我添加了如下数据
apple
mango
banana
guava
在.csv文件中,它保存为四行而不是单行。
下面是我的代码如何iam保存数据。
String address ;
address = textArea.getText();
writer.append(address);
writer.append(',');
谁能建议如何解决这个问题?
谢谢
为什么不用逗号替换JTextArea
的换行符,以便给您一个CSV行:
writer.append(address.replace("\n", ","));
输出:
apple,mango,banana,guava
writer.append(address.replace("\n", "-"));
Use character other than ",". If not, data will be placed in consecutive cell of the same row
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.