|  | Home · Overviews · Examples |

# QTextDocumentFragment Class Reference
[com.trolltech.qt.gui module]

The `QTextDocumentFragment` class represents a piece of formatted text from a `QTextDocument`. More...

## Detailed Description

The `QTextDocumentFragment` class represents a piece of formatted text from a `QTextDocument`.

A `QTextDocumentFragment` is a fragment of rich text, that can be inserted into a `QTextDocument`. A document fragment can be created from a `QTextDocument`, from a `QTextCursor`'s selection, or from another document fragment. Document fragments can also be created by the static functions, `fromPlainText` and `fromHtml`.

The contents of a document fragment can be obtained as plain text by using the `toPlainText` function, or it can be obtained as HTML with `toHtml`.