Automate Word using Text Object Model?

R

Robert Jacobson

Hi,

I'm a VB.Net developer, and I'm designing an add-in for Microsoft Word. My
program needs to retrieve formatting information about each character in the
document. (Bold, italics, etc.) I tried iterating through each character
using the Range object, but the performance was poor. (I first blamed the
performance on interop, but found similar performance issues even when I
ran it in VBA.)

I've been reading up on the Text Object Model, which appears promising. (It
provides an interface for interacting with a document, including information
about character formatting.) According to MSDN, it can be used to interact
with Word.

http://msdn.microsoft.com/library/d...latform/commctls/richedit/textobjectmodel.asp

There are some general samples of how to use this interface with RichEdit
controls here:

http://www.vbaccelerator.com/codelib/richedit/tomdemo.htm

However, I haven't found anything on how to use it to automate a Word
document. Before I spend too much time looking into this, does anyone have
experience using TOM with Microsoft Word and have any tips or pointers?

Thanks,
Robert Jacobson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top