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.

4

3 回答 3

11

我帮助在 KOffice 中编写了 RTF 导入导出过滤器。您可以在https://cgit.kde.org/koffice.git/tree/filters/kword/rtf查看代码。代码是模块化的,它只依赖于 Qt。

于 2009-03-11T09:23:36.940 回答
6

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.

于 2008-11-16T20:51:22.667 回答
2

你可以在irc上问那些#koffice家伙。irc.freenode.org他们的程序kword能够打开 RTF 文件,而且确实也是用 Qt 编写的。我相信他们会很乐意告诉你他们是如何做到的。

于 2008-11-17T02:06:22.843 回答