The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
[Originally posted by kiran]


I have to read an rtf file and split it into separate lines or objects and
then display each of the lines or objects in a separate text pane or text
I am reading the rtf file into a document object like this:

RTFEditorKit rk = new RTFEditorKit();
DataInputStream dis = new DataInputStream(new FileInputStream("in.rtf"));
String s1 = dis.readLine();
InputStream is = new ByteArrayInputStream(s1.getBytes());,jEditorPane1.getDocument(),0);

This option is generating a run time error saying "Truncated RTF File".

If I try using DataInputStream in the read function instead of InputStream
object, then also it is unable to display. If I use InputStream directly then
it reads the entire file and displays the entire file in a single text pane.
That is not useful in my case.

If I split the Document object into Element objects and then use each of the
Element object to create a separate document, it is posing the same problems.

My problem ultimately, is to create a set of Document objects from one
Document object and then use each of the Document object to update a

I need to do this quite urgently. Can anybody please tell me how to do this.

Thanks in advance.


import-bot (20211) [Avatar] Offline
Re: splitting an RTF file into multiple documents
[Originally posted by matt]

It looks like you are way off base with this..

Try looking at the examples in chapter 20 here:
...also see chapter 19..