TOM Classes for .NET is a managed assembly, written in C++/CLI, that provides a set of wrapper classes for the Text Object Model (TOM) interfaces. This allows .NET developers to access the functionality of the native
ITextDocument interface without the need to use dynamic programming or COM interop. The assembly includes the following classes:
- TextDocument (ITextDocument)
- TextRange (ITextRange)
- TextSelection (ITextSelection)
- TextFont (ITextFont)
- TextPara (ITextPara)
- TextStoryRanges (ITextStoryRanges)
TOM 2 support
The latest version includes support for TOM 2 (available on Windows 8 and higher). Each of the above classes wraps both the TOM 1 and TOM 2 interfaces (e.g.
ITextDocument2), and will automatically select the best available version. In addition, TOM 2 adds the following classes:
- TextStory (ITextStory)
- TextRow (ITextRow)
- TextStrings (ITextStrings)
- RichTextBoxEx – an extended version of the Windows Forms
RichTextBoxcontrol which automatically loads the newest available version of the native RichEdit control (required for advanced functionality).
- TextExtensions – provides extension methods for working with ranges using a more familiar syntax, as well as conversion of math text to OMML and MathML.
- .NET Framework 4.5
- Windows Vista or higher
- Visual C++ 2012 Redistributable (or Visual Studio 2012)
Current version: 1.0.2
ManagedTOM2-1.0.2-bin.zip (includes x86/x64 DLLs, TOM 1-only DLLs, IntelliSense XML and help file)
ManagedTOM2-1.0.2-src.zip (Visual Studio 2012 solution, includes demo application and help file)
RichTextBoxExbeing unable to select the correct RichEdit control where multiple versions of Office have been installed.
- Fixed the
TextDocumentnot working as documented.
- Added the ability to manually specify a DLL and window class name for
- Other minor tweaks and enhancements.
- Extract the binaries to a location on disk.
- Note: You may have to right-click the DLLs and select the ‘Unblock’ option on the Properties window (in order to fix trust issues in Visual Studio).
- Add a reference to the required assembly (x86 or x64, TOM 2 or TOM 1-only) to your project.
- Note: You may have to manually add
RichTextBoxExto the Visual Studio toolbox if it does not automatically appear.
- Explore the
TextObjectModelnamespace and refer to the documentation to start using the TOM classes.
Help is included in the download packages, and is also available online: TOM Classes for .NET – Help