Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem using RTFEditorKit  RSS feed

Gauri Horane
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
" Too many close-groups in RTF text"
while reding the .rtf file means at
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,styledDoc,0);
Document doc = null;

doc = styledDoc.getDefaultRootElement().getDocument();

String str= doc.getText(0,doc.getLength());
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!