Click or drag to resize
TextDocument Class
Represents a top-level document in the Text Object Model (TOM).
Inheritance Hierarchy
SystemObject
  TextObjectModelTextDocument

Namespace: TextObjectModel
Assembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax
public class TextDocument : IDisposable

The TextDocument type exposes the following members.

Methods
  NameDescription
Public methodAttachMsgFilter
(TOM 2 only) Attaches a new message filter to the edit instance. All window messages that the edit instance receives are forwarded to the message filter.
Public methodBeginEditCollection
Turns on edit collection (also called undo grouping).
Public methodCode exampleBeginUpdate
Increments the freeze count. If the freeze count is nonzero, screen updating is disabled.
Public methodCheckTextLimit
(TOM 2 only) Checks whether the number of characters to be added would exceed the maximum text limit.
Public methodDispose
Releases all resources used by the TextDocument
Protected methodDispose(Boolean)
Releases the unmanaged resources used by the TextDocument and optionally releases the managed resources
Public methodEndEditCollection
Turns off edit collection (also called undo grouping).
Public methodCode exampleEndUpdate
Decrements the freeze count. If the freeze count goes to zero, screen updating is enabled.
Protected methodFinalize (Overrides ObjectFinalize.)
Public methodStatic memberFromComObject
Creates a TextDocument instance from the specified COM object.
Public methodStatic memberFromIUnknown
Creates a TextDocument instance from a pointer to an IUnknown object.
Public methodStatic memberFromRichEditControl
Creates a TextDocument instance from a RichEdit control.
Public methodStatic memberCode exampleFromRichTextBox
Creates a TextDocument instance from the specified RichTextBox control.
Public methodGetClientRectangle
(TOM 2 only) Retrieves the client rectangle of the rich edit control.
Public methodGetDisplays
(TOM 2 only) Gets the displays collection for this Text Object Model (TOM) engine instance.
Public methodGetEffectColor
(TOM 2 only) Retrieves the color used for special text attributes.
Public methodGetNewStory
(TOM 2 only) Gets a new story.
Public methodGetPreferredFont
(TOM 2 only) Retrieves the preferred font for a particular character repertoire and character position.
Public methodGetStory
(TOM 2 only) Retrieves the story that corresponds to a particular index.
Public methodGetStrings
(TOM 2 only) Gets a new collection of rich-text strings.
Public methodNew
Opens a new document.
Public methodNotify
(TOM 2 only) Notifies the TOM engine client of particular IME events.
Public methodOpen
Opens a specified document.
Public methodRange
Retrieves a text range object for a specified range of content in the active story of the document.
Public methodRangeFromPoint
Retrieves a range for the content at or nearest to the specified point on the screen.
Public methodRedo
Performs a specified number of redo operations.
Public methodResumeUndo
Resumes undo processing.
Public methodSave
Saves the document.
Public methodSetEffectColor
(TOM 2 only) Specifies the color to use for special text attributes.
Public methodSetIMEInProgress
(TOM 2 only) Sets the state of the IME in-progress flag.
Public methodSuspendUndo
Suspends undo processing.
Public methodSysBeep
(TOM 2 only) Generates a system beep.
Public methodToString
Returns the name of the document, or "Document" if Name is empty.
(Overrides ObjectToString.)
Public methodUndo
Performs a specified number of undo operations.
Public methodUpdate
(TOM 2 only) Updates the selection and caret.
Public methodUpdateWindow
(TOM 2 only) Notifies the client that the view has changed and the client should update the view if the TOM engine is in-place active.
Top
Properties
  NameDescription
Public propertyActiveStory
(TOM 2 only) Gets or sets the active story; that is, the story that receives keyboard and mouse input.
Public propertyAdvancedTypographyEnabled
(TOM 2 only) Gets or sets a value indicating whether advanced typography (special line breaking and line formatting) is turned on.
Public propertyCaretType
(TOM 2 only) Gets or sets the caret type.
Public propertyDefaultTabStop
Gets or sets the default tab width.
Public propertyDocumentFont
(TOM 2 only) Gets or sets a TextFont that provides the default character format information for this instance of the TOM engine.
Public propertyDocumentPara
(TOM 2 only) Gets or sets a TextPara that provides the default paragraph format information for this instance of the TOM engine.
Public propertyEastAsianFlags
(TOM 2 only) Gets the East Asian flags.
Public propertyEntireRange
Returns a TextRange representing the entire document.
Public propertyGenerator
(TOM 2 only) Gets the name of the TOM engine.
Public propertyMainStory
(TOM 2 only) Gets the main story.
Public propertyMathProperties
Provides access to the math properties for the document.
Public propertyName
Gets the file name of this document.
Public propertyNotificationMode
(TOM 2 only) Gets or sets the notification mode.
Public propertyProperties
Provides access to the properties of the document.
Public propertySaved
Gets or sets a value that indicates whether changes have been made since the file was last saved.
Public propertySelection
Gets the active selection.
Public propertyStoryRanges
Gets a TextStoryRanges which enumerates through the stories in the document.
Public propertySupportedVersion
Gets a value indicating which version of the Text Object Model (TOM) is supported by the current document.
Public propertyWindowHandle
(TOM 2 only) Gets the handle of the window that the TOM engine is using to display output.
Top
Remarks

Managed wrapper class for the COM interface ITextDocument, including ITextDocument2 functionality.

You can obtain an instance TextDocument in a number of ways:

  • From an instance of the Windows Forms RichTextBox control (using the FromRichTextBox(RichTextBox, Boolean) method). This is the preferred method.
  • From a native RichEdit control (by passing its window handle to the FromRichEditControl(IntPtr, Boolean) method). Use this method if you need to use a specific or custom version of the RichEdit control that you have instantiated yourself.
  • From a Runtime Callable Wrapper (RCW) for a COM object that implements the ITextDocument interface (see FromComObject(Object) method).
  • From an unmanaged pointer to the IUnknown interface of a COM object that implements ITextDocument (see FromIUnknown(IntPtr) method).
See Also