tags:

views:

3019

answers:

5

Hello,

I am looking for a simple C++ library for tokenizing and parsing RTF (Rich Text Format) files. I am planning to edit them with Qt's QTextEdit.

More the Formatting preserved the better -- but actually I am planning to use Bold and Italics only.

In perl I would use RTF::Tokenizer.

It would be nice if the module had some sort of interface for writing also, but I am able to brute force that with a template and some regular expressions... :)

Thank you.

+3  A: 

A quick SourceForge search suggests librtf. It hasn't been developed in a while, but is listed as stable and is under the LGPL. I don't know whether it will support what you need, but I always suggest searching SourceForge for libraries.

coppro
That looks good. Thank you!
+2  A: 

You can ask the #koffice guys on irc.freenode.org over irc. Their program kword is able to open RTF files, and is indeed also written in Qt. I'm sure they would be glad to tell you about how they do it.

Johannes Schaub - litb
A: 

I know you were looking for a library, but there seems to be some excellent documentation here. Good luck

mdec
+5  A: 

I helped writing the RTF import export filter in KOffice. You can have a look at the code at http://websvn.kde.org/trunk/koffice/filters/kword/rtf/ or just checkout (via subversion). The code is modular and it depends only on Qt.

Ariya Hidayat
A: 

I am also looking for RTF reader library . Maybe someone have any idea where to find ?