ITextDocument interface
The ITextDocument interface is the Text Object Model (TOM) top-level interface, which retrieves the active selection and range objects for any story in the document—whether active or not. It enables the application to:
- Open and save documents.
- Control undo behavior and screen updating.
- Find a range from a screen position.
- Get an ITextStoryRanges story enumerator.
When to Implement
Applications typically do not implement the ITextDocument interface. Microsoft text solutions, such as rich edit controls, implement ITextDocument as part of their TOM implementation.
When to Use
Applications can retrieve an ITextDocument pointer from a rich edit control. To do this, send an EM_GETOLEINTERFACE message to retrieve an IRichEditOle object from a rich edit control. Then, call the object's IUnknown::QueryInterface method to retrieve an ITextDocument pointer.
Members
The ITextDocument interface inherits from the IUnknown interface. ITextDocument also has these types of members:
Methods
The ITextDocument interface has these methods.
| Method | Description |
|---|---|
| BeginEditCollection |
Turns on edit collection (also called undo grouping). |
| EndEditCollection |
Turns off edit collection (also called undo grouping). |
| Freeze |
Increments the freeze count. |
| GetDefaultTabStop |
Gets the default tab width. |
| GetName |
Gets the file name of this document. This is the ITextDocument default property. |
| GetSaved |
Gets a value that indicates whether changes have been made since the file was last saved. |
| GetSelection |
Gets the active selection. |
| GetStoryCount |
Gets the count of stories in this document. |
| GetStoryRanges |
Gets the story collection object used to enumerate the stories in a document. |
| New |
Opens a new document. |
| Open |
Opens a specified document. There are parameters to specify access and sharing privileges, creation and conversion of the file, as well as the code page for the file. |
| Range |
Retrieves a text range object for a specified range of content in the active story of the document. |
| RangeFromPoint |
Retrieves a range for the content at or nearest to the specified point on the screen. |
| Redo |
Performs a specified number of redo operations. |
| Save |
Saves the document. |
| SetDefaultTabStop |
Sets the default tab stop, which is used when no tab exists beyond the current display position. |
| SetSaved |
Sets the document Saved property. |
| Undo |
Performs a specified number of undo operations. |
| Unfreeze |
Decrements the freeze count. |
Requirements
|
Minimum supported client |
Windows Vista [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
DLL |
|
See also
- Conceptual
- Text Object Model
- Using The Text Object Model