开发者

Is there a way to output contents of a StyledDocument in HTML?

开发者 https://www.devze.com 2023-01-21 18:47 出处:网络
I need to save contents of StyledDocument, formatted with standard styles (e.g. bold, italic, various font sizes). And so there is my questio开发者_如何学Pythonn - is it possible to output it into HTM

I need to save contents of StyledDocument, formatted with standard styles (e.g. bold, italic, various font sizes). And so there is my questio开发者_如何学Pythonn - is it possible to output it into HTML someway?


Found the answer. I just used HTMLEditorKit, got list of it's actions, and assigned actions to buttons. Then JTextPane.getText() returns the html-formatted string.


Yes you can use the 'write' method of 'HTMLEditorKit'

  • http://download.oracle.com/javase/6/docs/api/javax/swing/text/html/HTMLEditorKit.html

The document gonna be write in HTML 3.2

0

精彩评论

暂无评论...
验证码 换一张
取 消