AndreasN wrote:The next challenge is the measurement of Tc objects for instance to calculate the coordinates of the <v:line /> to "draw" on a particular area.
Is it possible to get the coordinates of Tc objects or whatever element I want?
It is not currently possible to get the coordinates of an object, because that would require us to have a page layout model identical to Word's (which we don't have).
The good news though is that you shouldn't need it, if you use a canvas, and position that canvas "relative" to its context, rather than absolute. If you use a canvas, the numbers inside it are all relative to that, not the page.
Before you jump in to creating VML, please be aware that DrawingML is probably a better option. When you add stuff to a canvas is Word 2010, then save the docx, you end up with something like:
Using xml Syntax Highlighting
<mc:AlternateContent>
<mc:Choice Requires="wpc">
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="2286000" cy="1333500"/>
<wp:effectExtent l="0" t="0" r="0" b="0"/>
<wp:docPr id="1" name="Canvas 1"/>
<wp:cNvGraphicFramePr>
<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>
</wp:cNvGraphicFramePr>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas">
<wpc:wpc>
<wpc:bg/>
<wpc:whole/>
<wps:wsp>
<wps:cNvPr id="2" name="Straight Connector 2"/>
<wps:cNvCnPr/>
<wps:spPr>
<a:xfrm>
<a:off x="85725" y="142875"/>
<a:ext cx="1905000" cy="971550"/>
</a:xfrm>
<a:prstGeom prst="line">
<a:avLst/>
</a:prstGeom>
</wps:spPr>
<wps:style>
<a:lnRef idx="1">
<a:schemeClr val="accent1"/>
</a:lnRef>
<a:fillRef idx="0">
<a:schemeClr val="accent1"/>
</a:fillRef>
<a:effectRef idx="0">
<a:schemeClr val="accent1"/>
</a:effectRef>
<a:fontRef idx="minor">
<a:schemeClr val="tx1"/>
</a:fontRef>
</wps:style>
<wps:bodyPr/>
</wps:wsp>
</wpc:wpc>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
</mc:Choice>
<mc:Fallback>
<w:pict>
<v:group id="Canvas 1" o:spid="_x0000_s1026" editas="canvas" style="width:180pt;height:105pt;mso-position-horizontal-relative:char;mso-position-vertical-relative:line" coordsize="22860,13335" o:gfxdata="UEsDBBQABgAIAA...AAAABAAEAPMAAABKBQAAAAA=
">
<v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype>
<v:shape id="_x0000_s1027" type="#_x0000_t75" style="position:absolute;width:22860;height:13335;visibility:visible;mso-wrap-style:square">
<v:fill o:detectmouseclick="t"/>
<v:path o:connecttype="none"/>
</v:shape>
<v:line id="Straight Connector 2" o:spid="_x0000_s1028" style="position:absolute;visibility:visible;mso-wrap-style:square" from="857,1428" to="19907,11144" o:connectortype="straight" o:gfxdata="UEsDB...RAwAAAAA=
" strokecolor="#4579b8 [3044]"/>
<w10:anchorlock/>
</v:group>
</w:pict>
</mc:Fallback>
</mc:AlternateContent>
Parsed in 0.008 seconds, using
GeSHi 1.0.8.4
That is, the content expressed in both DrawingML and VML. In this case, the DrawingML will be used if the consuming application supports "wpc".
On load, docx4j selects one of the options (and discards the other).
But there is nothing to stop you choosing to use and add DrawingML (ie without the enclosing mc elements, and instead of legacy VML and its @o:gfxdata).