List of usage examples for javax.swing.text.rtf RTFEditorKit write
public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException
From source file:com.hexidec.ekit.EkitCore.java
public String getRTFDocument() throws IOException, BadLocationException { StyledDocument doc = (StyledDocument) (jtpMain.getStyledDocument()); StringWriter strwriter = new StringWriter(); RTFEditorKit rtfKit = new RTFEditorKit(); rtfKit.write(strwriter, doc, 0, doc.getLength()); return strwriter.toString(); }
From source file:com.hexidec.ekit.EkitCore.java
/** * Method for saving text as an RTF document *//*from www . java 2 s . co m*/ public void writeOutRTF(StyledDocument doc, File rtfFile) throws IOException, BadLocationException { FileOutputStream fos = new FileOutputStream(rtfFile); RTFEditorKit rtfKit = new RTFEditorKit(); rtfKit.write(fos, doc, 0, doc.getLength()); fos.flush(); fos.close(); refreshOnUpdate(); }