Read (and write) RTF files with C++ / Qt [closed]
Asked Answered
F

3

16

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.

Fourteenth answered 16/11, 2008 at 20:21 Comment(1)
did you ever find a working answer?Bensky
G
10

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.

Gamut answered 11/3, 2009 at 9:23 Comment(2)
This link seems to be broken.Revivify
This one seems to work: projects.kde.org/projects/unmaintained/koffice/repository/…Geist
L
5

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.

Laroche answered 16/11, 2008 at 20:51 Comment(1)
Well RTF hasn't seen a development either, so maybe it's just feature complete like libjpeg or libpng. Microsoft who once created for office document exchange officially put it to rest 10 years ago with office 2007 in favour of the open office xml format.Bravo
D
1

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.

Deledda answered 17/11, 2008 at 2:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.