get the co-ordinates and dimensions of a selection RRS feed

  • Question

  • I am writing a MS Word add-in using VSTO. I need to get the co-ordinates and dimensions of a selection (usually a content control) in points. This is so I can map object locations on particular pages, as word can only give me page height and width in points.

    How can I do this?

    Tuesday, August 25, 2015 12:37 PM


  • Hi Roland

    Word won't be able to tell you this with any kind of accuracy as it's not a layout program and doesn't set much emphasis on where things are located, absolutely. It's not really clear why you need it (end purpose), but Word might not be the proper tool for what you need...

    In Word's object model is a method GetPoint that derives from a Windows Api call. If you're lucky, the information it returns will be good enough for your requirement.

    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, August 25, 2015 1:44 PM