Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenXml and Word: How to Calculate WrapPolygon Coordinates?
    text
    copied!<p>I am creating a Microsoft Word document using the OpenXml library. Most of what I need is already working correctly. However, I can't for the life of me find the following bit of information.</p> <p>I'm displaying an image in an anchor, which causes text to wrap around the image. I used <code>WrapSquare</code> but this seems to affect the last line of the <em>previous</em> paragraph as shown in the image below. The image is anchored to the second paragraph but causes the last line of the first paragraph to also indent around the image.</p> <p><a href="http://www.softcircuits.com/Client/Word.jpg" rel="nofollow noreferrer">Word Screenshot http://www.softcircuits.com/Client/Word.jpg</a></p> <p>Experimenting within Word, I can make the text wrap how I want by changing the wrapping to <code>WrapTight</code>. However, this requires a <code>WrapPolygon</code> with several coordinates. And I can't find any way to determine the polygon coordinates so that they match the size of the image, which is in pixels.</p> <p>The documentation doesn't even seem to indicate what units are used for these coordinates, let alone how to calculate them from pixels. I can only assume the calculation would involve a DPI value, but I have no idea how to determine what DPI will be used when the user eventually loads the document into Word.</p> <p>I would also be satisfied if someone can explain why the issues described above is happening in the first place. I can shift the image down and the previous paragraph is no longer affected. But why is this necessary? (The Distance from text setting for both Left and Top is 0".)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload