aspose file tools*
The moose likes Beginning Java and the fly likes how to read rtf file and display in console? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to read rtf file and display in console?" Watch "how to read rtf file and display in console?" New topic
Author

how to read rtf file and display in console?

nuur alif
Greenhorn

Joined: Nov 12, 2008
Posts: 10
Hello there..

can any of these family guide me in how to read RTF file content?
i want to manipulate the string content(example get the length) and display it in console.

it is possible? from my 'homework' it can be done using awt.huhu..i just want to display it in console.no need GUI? :roll:

thanks in advanced for your concern!
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Looks like RTF is a format developed by Microsoft. I believe you may be able to read these formats using a library called Apache POI. That's as much as I can help.

May be if you explain a bit more about your problem others may chip in..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
No, POI has no provisions for reading RTF. But the basic structure of RTF isn't complicated. If you spend some time with the specification (such as there is) and study a few simple RTF files, you should be able to write code that parses the file contents and extracts the actual text.


Ping & DNS - my free Android networking tools app
nuur alif
Greenhorn

Joined: Nov 12, 2008
Posts: 10
Originally posted by Ulf Dittmer:
No, POI has no provisions for reading RTF. But the basic structure of RTF isn't complicated. If you spend some time with the specification (such as there is) and study a few simple RTF files, you should be able to write code that parses the file contents and extracts the actual text.


thanks! you do help much and i am trying to study about RTF and java..

hmm.. it is possible?

for example, i want to write an arabic text and save it as .RTF file.
then i want to read the .RTF file as a unicode. without using GUI ( in this case RTF Editor KIT)

I just want to read the arabic character which is in .RTF file.Then i want to manipulate each arabic charater. Hmm..

is it relate about encodings?
how to set to arabic encodings?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
RTF is just plain text. I'd suggest to create a simple file containing Arabic characters, save it as RTF, and then use a text editor to look at what got created. Armed with that, it shouldn't be hard to figure out how to create RTF files; the RTF documentation can help fill in the blanks after that.
nuur alif
Greenhorn

Joined: Nov 12, 2008
Posts: 10
hmm.. i had done that way...where i write and save it as RTF file with UTF-8 encodings..but they display ???

i need to get the character because i want to sort the character..hmm..?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41843
    
  63
Where are the characters displayed as question marks? In the console? In the editor? If the former, most consoles can't display Unicode. If the latter, make sure the editor can handle Unicode (and Arabic) in general (meaning it has fonts and selects those properly).
nuur alif
Greenhorn

Joined: Nov 12, 2008
Posts: 10
Originally posted by Ulf Dittmer:
Where are the characters displayed as question marks? In the console? In the editor? If the former, most consoles can't display Unicode. If the latter, make sure the editor can handle Unicode (and Arabic) in general (meaning it has fonts and selects those properly).


hmm.. i am trying learn from example..



i am using awt ..java applet to display ..the output is ���������
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to read rtf file and display in console?