QTextDocumentWriter Class

The QTextDocumentWriter class provides a format-independent interface for writing a QTextDocument to files or other devices. More...

Header: #include <QTextDocumentWriter>
qmake: QT += gui
Since: Qt 4.5

This class was introduced in Qt 4.5.

Detailed Description

To write a document, construct a QTextDocumentWriter object with either a file name or a device object, and specify the document format to be written. You can construct a writer and set the format using setFormat() later.

Call write() to write the document to the device. If the document is successfully written, this function returns true. However, if an error occurs when writing the document, it will return false.

Call supportedDocumentFormats() for a list of formats that QTextDocumentWriter can write.

Since the capabilities of the supported output formats vary considerably, the writer simply outputs the appropriate subset of objects for each format. This typically includes the formatted text and images contained in a document.