Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to read rtf file and display in console?

 
nuur alif
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
nuur alif
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ���������
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic