RtfText.h header

#include <ew/app/RtfText.h>

Namespace ew::app

Functions

QString ew::app::rtfToPlainText(const QString &rtf)

Extracts the plain text from an RTF document (rtf), discarding all formatting.

This is a text extractor, not a full RTF renderer: control words become their textual effect where one is meaningful (\par, \line, \sect and the like become a newline; \tab becomes a tab; \uN and \'XX become the character they encode, decoding hex bytes as Windows-1252) and everything else – font, colour and stylesheet tables, list tables, embedded pictures/objects and ignorable \* destinations – is dropped. Group nesting and the \ucN Unicode fallback-skip count are honoured so a \uN character is not doubled by its ASCII fallback. Malformed or empty input yields an empty string. Intended for importing RTF-backed documents (for example a Scrivener project's per-document content.rtf) as prose.