| Author |
Problem using RTFEditorKit
|
Gauri Horane
Greenhorn
Joined: Mar 10, 2005
Posts: 7
|
|
hello everybody, i want to read the text from the .rtf file. i m using " javax.swing.text.rtf.RTFEditorKit"; i used the following code for that. But for some .rtf files it worked finly but for some .rtf files it throws the following Exception. "java.io.IOException: Too many close-groups in RTF text" while reding the .rtf file means at line " rtfKit.read(din,styledDoc,0);" in the following code. can anybody tell me where is the problem & solution for it. *********************************************************** FileInputStream fin = new FileInputStream("FileName"); DataInputStream din = new DataInputStream(fin); System.out.println("IN getFileName()():3333333333"); DefaultStyledDocument styledDoc = new DefaultStyledDocument(); System.out.println("IN getFileName()():4444444444444"); //Creating a RTF Editor kit RTFEditorKit rtfKit = new RTFEditorKit(); //Populating the contents in the blank styled document rtfKit.read(din,styledDoc,0); Document doc = null; doc = styledDoc.getDefaultRootElement().getDocument(); String str= doc.getText(0,doc.getLength());
|
 |
 |
|
|
subject: Problem using RTFEditorKit
|
|
|