[英]Copy/paste from JTextPane to others application without text formatting support
I have a JTextPane with contentType set to "text/html". 我有一个contentType设置为“ text / html”的JTextPane。 The content of the JTextPane is formatted with html.
JTextPane的内容使用html格式化。 My lines are formatted like this: "<p>hello</p>\\n".
我的行格式如下:“ <p>你好</ p> \\ n”。
I'm able to copy data from my JTextPane to an application that support text formatting like OpenOffice (I get my text with formatting like color and lines breaks), but when I try to paste my data to an application that doesn't support text formatting (like gedit), I lose my lines breaks (I get all the lines merged into one single line). 我可以将数据从JTextPane复制到支持文本格式(例如OpenOffice)的应用程序(我的文本具有颜色和换行符的格式),但是当我尝试将数据粘贴到不支持文本的应用程序中时格式设置(如gedit),我丢失了换行符(将所有行合并为一行)。
Any idea how to be able to correctly paste my text with lines breaks to application that doesn't support text formatting? 任何想法如何能够正确地用换行符粘贴我的文本到不支持文本格式的应用程序?
Thanks! 谢谢!
Forget it... I found that my html formatting was bad. 算了...我发现我的html格式不好。 It's working now with a correct formatting.
现在可以使用正确的格式工作。 I don't even need a
\\n
after the <p>
在
<p>
之后,我甚至不需要\\n
tags, swing
convert it to line break automatically. 标签,
swing
将其转换为线路自动断开。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.