# RichEditTextDocument

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/rich_text/struct-richedittextdocument/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct RichEditTextDocument
```

Editing services over a shared FerroUI document. Range objects and selection commands
use the same transaction history as the visual editor, and can also be used headlessly.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L237)

## Members

- [`load_from_stream`](#function-load_from_stream)
- [`save_to_stream`](#function-save_to_stream)
- [`can_copy`](#function-can_copy)
- [`can_paste_from_clipboard_async`](#function-can_paste_from_clipboard_async)
- [`new`](#function-new)
- [`from_editor`](#function-from_editor)
- [`document`](#function-document)
- [`editor`](#function-editor)
- [`text`](#function-text)
- [`text_length`](#function-text_length)
- [`selection`](#function-selection)
- [`get_range`](#function-get_range)
- [`document_range`](#function-document_range)
- [`get_range_from_point`](#function-get_range_from_point)
- [`set_text`](#function-set_text)
- [`get_default_character_format`](#function-get_default_character_format)
- [`set_default_character_format`](#function-set_default_character_format)
- [`get_default_paragraph_format`](#function-get_default_paragraph_format)
- [`set_default_paragraph_format`](#function-set_default_paragraph_format)
- [`default_tab_stop`](#function-default_tab_stop)
- [`set_default_tab_stop`](#function-set_default_tab_stop)
- [`get_text`](#function-get_text)
- [`set_text_with_options`](#function-set_text_with_options)
- [`undo_limit`](#function-undo_limit)
- [`set_undo_limit`](#function-set_undo_limit)
- [`clear_undo_redo_history`](#function-clear_undo_redo_history)
- [`can_undo`](#function-can_undo)
- [`can_redo`](#function-can_redo)
- [`undo`](#function-undo)
- [`redo`](#function-redo)
- [`edit_group`](#function-edit_group)
- [`field_story`](#function-field_story)

<a id="function-load_from_stream"></a>

### load_from_stream

```rust
fn load_from_stream(self: &Self, options: TextSetOptions, reader: &mut dyn Read, stream: TextStreamOptions) -> Result<(), TextOperationError>
```

Loads from the reader's current position. I/O, decoding, and parsing finish
before document/default/history changes or composition cancellation. The
caller retains ownership of the reader; it is never sought or closed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_stream.rs#L44)

<a id="function-save_to_stream"></a>

### save_to_stream

```rust
fn save_to_stream(self: &Self, options: TextGetOptions, writer: &mut dyn Write, stream: TextStreamOptions) -> Result<(), TextOperationError>
```

Writes an encoded snapshot at the writer's current position. Validation and
encoding finish before the first write. An I/O error may leave a written
prefix; this method never seeks, truncates, flushes, or closes the writer.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_stream.rs#L68)

<a id="function-can_copy"></a>

### can_copy

```rust
fn can_copy(self: &Self) -> bool
```

Whether copying document content is permitted. This is independent of
selection length and edit protection. FerroUI documents currently have
no copy-protection policy, so copying is permitted even for an empty or
read-only document.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_clipboard.rs#L70)

<a id="function-can_paste_from_clipboard_async"></a>

### can_paste_from_clipboard_async

```rust
fn can_paste_from_clipboard_async(self: &Self, clipboard: Rc<dyn IClipboard>) -> LocalBoxFuture<Result<bool, ClipboardError>>
```

Queries the clipboard's supported representations without reading their
payloads or changing selection, composition, document state, or history.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_clipboard.rs#L76)

<a id="function-new"></a>

### new

```rust
fn new(document: RichTextDocument) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L242)

<a id="function-from_editor"></a>

### from_editor

```rust
fn from_editor(editor: Rc<RichTextEditor>) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L245)

<a id="function-document"></a>

### document

```rust
fn document(self: &Self) -> RichTextDocument
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L248)

<a id="function-editor"></a>

### editor

```rust
fn editor(self: &Self) -> Rc<RichTextEditor>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L255)

<a id="function-text"></a>

### text

```rust
fn text(self: &Self) -> String
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L258)

<a id="function-text_length"></a>

### text_length

```rust
fn text_length(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L261)

<a id="function-selection"></a>

### selection

```rust
fn selection(self: &Self) -> RichEditTextSelection
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L264)

<a id="function-get_range"></a>

### get_range

```rust
fn get_range(self: &Self, start: usize, end: usize) -> Result<RichEditTextRange, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L269)

<a id="function-document_range"></a>

### document_range

```rust
fn document_range(self: &Self) -> Result<RichEditTextRange, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L272)

<a id="function-get_range_from_point"></a>

### get_range_from_point

```rust
fn get_range_from_point(self: &Self, view: &RichTextBlock, point: Point) -> Result<RichEditTextRange, EditError>
```

Hit tests the host's measured, shaped layout in local control coordinates.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L276)

<a id="function-set_text"></a>

### set_text

```rust
fn set_text(self: &Self, text: &str) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L285)

<a id="function-get_default_character_format"></a>

### get_default_character_format

```rust
fn get_default_character_format(self: &Self) -> CharacterFormat
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L290)

<a id="function-set_default_character_format"></a>

### set_default_character_format

```rust
fn set_default_character_format(self: &Self, format: &CharacterFormat) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L294)

<a id="function-get_default_paragraph_format"></a>

### get_default_paragraph_format

```rust
fn get_default_paragraph_format(self: &Self) -> ParagraphFormat
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L298)

<a id="function-set_default_paragraph_format"></a>

### set_default_paragraph_format

```rust
fn set_default_paragraph_format(self: &Self, format: &ParagraphFormat) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L302)

<a id="function-default_tab_stop"></a>

### default_tab_stop

```rust
fn default_tab_stop(self: &Self) -> f64
```

Default tab spacing in TOM points; shared by all facades of this editor.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L307)

<a id="function-set_default_tab_stop"></a>

### set_default_tab_stop

```rust
fn set_default_tab_stop(self: &Self, points: f64) -> Result<(), EditError>
```

Applies document-wide implicit tab spacing as one undoable format edit.
Explicit paragraph stops and unrelated formatting are retained.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L317)

<a id="function-get_text"></a>

### get_text

```rust
fn get_text(self: &Self, options: TextGetOptions) -> Result<String, TextOperationError>
```

Retrieves native paragraph separators while retaining the model's UTF-16
coordinate system. The complete-story projection synthesizes its terminal
paragraph mark for None or AllowFinalEop, as the source TOM fixture requires.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L335)

<a id="function-set_text_with_options"></a>

### set_text_with_options

```rust
fn set_text_with_options(self: &Self, options: TextSetOptions, text: &str) -> Result<(), TextOperationError>
```

Replaces the complete story and its paragraph metadata. Plain content starts
with document defaults; RTF retains all formatting the codec can represent.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L349)

<a id="function-undo_limit"></a>

### undo_limit

```rust
fn undo_limit(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L422)

<a id="function-set_undo_limit"></a>

### set_undo_limit

```rust
fn set_undo_limit(self: &Self, limit: usize)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L426)

<a id="function-clear_undo_redo_history"></a>

### clear_undo_redo_history

```rust
fn clear_undo_redo_history(self: &Self)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L430)

<a id="function-can_undo"></a>

### can_undo

```rust
fn can_undo(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L433)

<a id="function-can_redo"></a>

### can_redo

```rust
fn can_redo(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L436)

<a id="function-undo"></a>

### undo

```rust
fn undo(self: &Self) -> Result<bool, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L439)

<a id="function-redo"></a>

### redo

```rust
fn redo(self: &Self) -> Result<bool, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L442)

<a id="function-edit_group"></a>

### edit_group

```rust
fn edit_group<T>(self: &Self, edit: impl FnOnce(&Self) -> Result<T, EditError>) -> Result<T, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L445)

<a id="function-field_story"></a>

### field_story

```rust
fn field_story(self: &Self) -> RichEditTextFieldStory
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_field_story.rs#L124)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
