How can I save the content of JTextPane as an html file?

Sandip Chitale

Say the content type of the JTextPane was of MIME type "text/html" then you can do -

import javax.swing.text.html.*;

...

JTextPane p = new JTextPane();
p.setContentType("text/html");

...

HTMLDocument hd = (HTMLDocument) p.getDocument();
HTMLWriter hw = new HTMLWriter(outputStream, hd);
hd.write();
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact