PDA

View Full Version : How to read rtf file and display it?



sunnysun520
14th May 2009, 13:13
Hi! I want to read a file which is the rtf format.what can I do?

JohannesMunk
14th May 2009, 14:05
Hi there!

QTextEdit internally supports/uses html for its rich text features.

To read Microsoft RTF files.. you will probably need some kind of conversion.

Google revealed, that someone else ran into the same problem:

http://stackoverflow.com/questions/294343/read-and-write-rtf-files-with-c-qt

One answer points to a RTF-Tokenizer used in KWord.

But to get that running in your project is probably quite a lot of work..

Maybe you can reduce the number of supported tokens?

Good luck!

Johannes

roxton
16th May 2009, 15:48
Hi! I want to read a file which is the rtf format.what can I do?

You can get some RTF-reading code from TEA text editor - http://tea-editor.sourceforge.net/