File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to read cell content from '*.rtf' file? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to read cell content from Watch "How to read cell content from New topic
Author

How to read cell content from '*.rtf' file?

vasiliy pankratov
Greenhorn

Joined: Apr 15, 2009
Posts: 4
Hello.

I need to read cell content from '*.rtf' file.
How can i get it in java?

Thanks in advanced.
Ryan Beckett
Ranch Hand

Joined: Feb 22, 2009
Posts: 192
Sun tutorials: I/O
vasiliy pankratov
Greenhorn

Joined: Apr 15, 2009
Posts: 4
Thanks, but it's not difficult to read '*.rtf' file - difficult to parse it.
I need to get cell content.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35252
    
    7
Welcome to JavaRanch.

I can think of two approaches. Either use OpenOffice in server mode to open the file, and get at the cell contents using its Java API.

Or write an RTF grammar for a lexer or parser. It wouldn't need to cover all of RTF, just the parts you're interested in. (The JavaCC parser actually has two RTF grammars available already, so that may be a good start.)


Android appsImageJ pluginsJava web charts
vasiliy pankratov
Greenhorn

Joined: Apr 15, 2009
Posts: 4
Thanks a lot.
I'll write a small rtf parser.
So strange that pure java have no libraries for reading '.rtf'.
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
hmmm... but there is a small work-around available.

You can convert your RTF to XML, and then do your parsing. Check out this link for more details.

http://www.theserverside.com/discussions/thread.tss?thread_id=21582
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32708
    
    4
Too difficult a question for us "beginners." Moving thread.
vasiliy pankratov
Greenhorn

Joined: Apr 15, 2009
Posts: 4
I wrote my small parser of ".rtf" file for my small task.
May be it will be bigger.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to read cell content from '*.rtf' file?
 
Similar Threads
Read RTF File from Java
Append two rtf files into one rtf document using io stream
How to update an RTF template file in java?
RTF to PDF transformation
rtf to html conversion