Read (and write) RTF files with C++ / Qt

user38075 picture user38075 · Nov 16, 2008 · Viewed 15.4k times · Source

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.

Answer

Ariya Hidayat picture Ariya Hidayat · Mar 11, 2009

I helped writing the RTF import export filter in KOffice. You can have a look at the code at https://cgit.kde.org/koffice.git/tree/filters/kword/rtf. The code is modular and it depends only on Qt.