|1||ActiveX Controls|| |
RichEdit 3.0 Text Object Model (TOM) Interface Sample
Using the vbAccelerator Control With the Version 3.0 of RichEd20.DLL
This sample demonstrates a class which provides a Text Object Model (TOM)
interface from version 3.0 of the RichEd20.DLL.
The MicrosoftÂ® Text Object Model (TOM) defines a set of text manipulation interfaces that are supported by text solutions such as Microsoft Word and the rich edit control. TOM has many methods and a powerful but simple COM object model, making it easy to use from VB and VBA and offering substantial text processing power.
Note to get RichEdit version 3.0 you either need to be running Win2000 or you need to download the Microsoft Systems Installer (MSI) redistributable.
Documentation for the Text Object Model's properties, methods and classes
is available as an RTF. This documentation was
created with the ActiveX Documenter (which itself
uses a variant of the RichEdit control!).
Click here to download/view the Text Object Model (TOM) method and event documentation
Unfortunately this object model does not seem to have any help text built into it (at least not with the version I currently have). To get more information about the object model and how to use all the objects in it you will need to also take a look at MSDN under this area:
User Interface Services
Windows User Interface
Rich Edit Controls
Text Object Model
An Overview of the TOM Model
The top-level TOM object is defined by the ITextDocument interface, which has methods for creating and retrieving objects lower in the object hierarchy. For simple, plain text processing, you can obtain an ITextRange object from an ITextDocument object.
If you need to add rich-text formatting, you can obtain ITextFont and ITextPara objects from an ITextRange object.
ITextFont provides the programming equivalent of the Microsoft Word Font dialog box, whilst ITextPara provides the equivalent of the Word Paragraph dialog box. In addition to these three lower-level objects, TOM has a selection object (ITextSelection), which is just an ITextRange object with selection highlighting and additional UI oriented methods. The range and selection objects include screen-oriented methods that enable programs to examine text on the screen or text that could be scrolled onto the screen.
Summarizing these objects in a hierarchical way, we have the following directory tree:
An ITextRange object is defined by its start and end character position (cp) offsets and a story object. As such, it does not exist independently of its parent story object, although its text can be copied to the clipboard or to other targets. A text range object is different from spreadsheet and other range objects, which are defined by other kinds of offsets, like row/column or graphics position (x,y). A text range object can: