dcsimg
How Can I get the text/associated attributes pair from a styled JTextPane to write to a customized text file?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   cihan_sahin
Posted On:   Tuesday, May 28, 2002 04:01 AM

I have a styled JTextPane and would like to write it to a file with a customized
format to be used by other scripts. For example;

Styled document has a line as "styled text test" and "text te" part of it
is bold. I want it to be written to file as ;

styled [bold]text te[/b]st

I think I should define a new EditorKit ?

Thanks..

Re: How Can I get the text/associated attributes pair from a styled JTextPane to write to a customized text file?

Posted By:   Jochen_Bedersdorfer  
Posted On:   Tuesday, May 28, 2002 04:41 AM

Yup, the trick would be to create your custom subclass
of javax.swing.text.AbstractWriter and make it available
using your own EditorKit.


Take a look at the sourcecode of

javax.swing.text.html.MinimalHTMLWriter.

This class writes out a StyledDocument as HTML.


Cheers,

Jochen

About | Sitemap | Contact