81,092
社区成员
发帖
与我相关
我的任务
分享
response.setContentType("text/html");
response.setCharacterEncoding("utf-8");
FCKeditor editor = new FCKeditor(request,"editor1"); //new 一个FCKeditor
FileInputStream in = new FileInputStream("d:/1.rtf"); //读取rtf文档的流
DefaultStyledDocument dsd = new DefaultStyledDocument ();
RTFEditorKit rtf = new RTFEditorKit();
String temp = new String();
try {
rtf.read(in, dsd, 0);
temp = new String(dsd.getText(0, dsd.getLength()).getBytes("ISO8859_1"));
//这样读出之后就有格式了
} catch (BadLocationException e) {
e.printStackTrace();
}
editor.setValue(temp);//把读到的字符串放到FCKeditor 中
in.close();
response.getWriter().println(editor); //吧FCKeditor 输出
ckeditor 主页
http://ckeditor.com/
ckeditor 文档
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting