bitmap weirdness - COM API disagrees with docx file

D

David Thielen

Please take a look at
http://www.windwardreports.com/temp/weird_bitmap.zip - in the DOCX it
has:
<wp:positionH relativeFrom="column">
<wp:posOffset>-1829</wp:posOffset>
</wp:positionH>

But when queried in the COM API Shape.Left == -999996 which means
right aligned.

But it is displayed left aligned in Word.

But when you go to the Text Wrapping, More Layout Options it says
right aligned.

What's going on?

thanks - dave

david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
J

Ji Zhou

Hello Dave,

This is a strange issue. It looks like both of Word UI and COM API do not
match the OpenXML document. I will submit the issue through internal
channel.

By the way, the picture appears in the left side because we set the
wp:posOffset to -1892 in OpenXML. So it actually appears as expected. But
just the UI and COM API display the incorrect align type.

Based on my understanding, this may not be a big issue because if I create a
document, insert a shape and set its align position. It will not generate
kind of "<wp:posOffset>-1829</wp:posOffset>" align position. So the document
we research here looks a little weird. If we are using OpenXML SDK to
generate the document programmatically, I suggest we generate it use
wp:align instead of wp:posOffset,

For example, if I modify the OpenXML content as,

<wp:positionH relativeFrom="column">
<wp:align>right</wp:align>
</wp:positionH>

and then open it in Word 2007 or 2010, the picture appears OK and matches
the Word UI and COM API values.

If you have any further questions or concerns on this, please let me know.


Best regards,
Ji Zhou
Microsoft Online Community Support
 
D

David Thielen

This is part of where we have to get all the properties, conver it to
an inline shape, read/write the bitmap, InsertXML(), convert to a
shape, then set the properties back. So we can't force any of the
attributes, etc.

It's a major mess, but the best we can do because Range.WordOpenXML
doesn't work for a Shape.

thanks - dave


Hello Dave,

This is a strange issue. It looks like both of Word UI and COM API do not
match the OpenXML document. I will submit the issue through internal
channel.

By the way, the picture appears in the left side because we set the
wp:posOffset to -1892 in OpenXML. So it actually appears as expected. But
just the UI and COM API display the incorrect align type.

Based on my understanding, this may not be a big issue because if I create a
document, insert a shape and set its align position. It will not generate
kind of "<wp:posOffset>-1829</wp:posOffset>" align position. So the document
we research here looks a little weird. If we are using OpenXML SDK to
generate the document programmatically, I suggest we generate it use
wp:align instead of wp:posOffset,

For example, if I modify the OpenXML content as,

<wp:positionH relativeFrom="column">
<wp:align>right</wp:align>
</wp:positionH>

and then open it in Word 2007 or 2010, the picture appears OK and matches
the Word UI and COM API values.

If you have any further questions or concerns on this, please let me know.


Best regards,
Ji Zhou
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top