Search code examples
c#ms-wordopenxml

How to get coordinates of Run or other WordProcessing element via OpenXML?


I was wondering if it is possible to find the coordinates of a specific Run (text, no drawing or other elements that have offset parameter) on a page in a Word document using OpenXML SDK. I know that OpenXML is basically .. well XML, and simple runs have no relative, numerical position embedded in them.

I was reading through OpenXML SDK API and found no clues but maybe I have missed something. By coordinates I mean any tuple that can be mapped to pixels if I would generated an image out of the page (imagine you made a screenshot of page)

I suspect, if this is possible, it is not trivial.

Appreciate your help!


Solution

  • The Open XML SDK does not include this functionality. This would require a layout engine, which is not part of the SDK.