PDA

View Full Version : Support for .rtf format in QTextDocument or QTextEdit?



LynneV
13th September 2010, 20:23
I have a case where newly entered text in a database column is in HTML format - and QTextDocument and QTextEdit work great. However, older (legacy) entries are in .rtf format (the first characters of the string are "{\rtf1"). Does anyone know how to support rtf in Qt widgets? I always get the equivalent of plain text. Thanks in advance for any assistance!

JohannesMunk
13th September 2010, 23:01
There is no support for Microsofts Rich Text Format in Qt. All "rich text" stuff is realized with html and css.

Look for an RTF to HTML Converter library. If there is none you will need to write one yourself. Starting point could be: http://latex2rtf.sourceforge.net/rtfspec_45.html

Edit: Just found this - http://www.codeproject.com/KB/recipes/RtfConverter.aspx

Edit2: If you need less features: http://www.codeguru.com/cpp/controls/richedit/conversions/article.php/c5377/RTF-to-HTML-Converter.htm

HIH

Joh