I want to access the position and size for each indivisible unit in Microsoft Word. Examples of such units include individual characters, images, etc.
The purpose is to apply a visual overlay based on unit position and size. I will have no knowledge of the content in target documents.
Imagine the text of this question in a word document. I need to be able to iterate each character including white-space and carriage returns and get the size and position.
EDIT
It doesn’t matter whether your answer considers macros, interop, add-ins or OLE embedding.
The method which retrieves displayed coordinates of an object is
Window.GetPoint(link for the office interop version, same thing in VBA).As for the “indivisible unit,” you can put any meaning you want into that, using the available collections.
For instance, if you want it to be characters, you can use
Document.Range.Characters, which is a collection of characters, each of which is aRange.Or you can use
Document.Range.InlineShapesfor the pictures that are part of text.Or
Document.Range.ShapeRangeto enumerate “floating” shapes.At which point you might be thinking about
Window.RangeFromPointto figure an object from its window coordinates.