Hi
I have an rtf document and I only want to get the text in that document.
For ex. I got an RTF file that looks like this:
{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil\fcharset204{\*\fname Arial;}Arial CYR;}}
{\colortbl ;\red0\green64\blue128;}
\viewkind4\uc1\pard\cf1\f0\fs20\'d1\'ef\'e0\'f1\'e8\'e1\'ee\par
}
It looks fine if I open the original rtf documnet in for ex. word but if I try to open it with RTFEditorKit it just looks bad.
The code I use to open it in java is:
FileInputStream f = new FileInputStream(args[1]);
RTFEditorKit rtf = new RTFEditorKit();
DefaultStyledDocument dsDoc = new DefaultStyledDocument();
rtf.read(f, dsDoc, 0);
javax.swing.JFrame frame = new javax.swing.JFrame();
javax.swing.JTextPane jtp = new javax.swing.JTextPane(dsDoc);
jtp.setCaretPosition(0);
jtp.setVisible(true);
frame.add(jtp);
frame.setVisible(true);
Any one know why???