locked
how to change w:pict to w:drawing in vsto develop RRS feed

  • Question

  • in word, a picture can be presented by w:pict(VML) or w:drawing(DrawingML), these two presentation will cause different word menu, is any way change VML object to DrawingML?

    under in word2013 vsto develop.

    thanks

    Tuesday, April 1, 2014 1:28 AM

Answers

  • Hi sendreams,

    Why do you want to convert VML object to DrawingML?

    In fact, both VML object and DrawingML are all InlineShape in Word, we can loop all ActiveDocument.Inlineshapes to find them. The difference is that VML is generated by dragging the picture into the document and DrawingML is generated by clicking the ribbon to insert a picture.

    Through Word Object Model, there is no direct way to convert them.

    If you insist on doing this, there is a workaround through Open XML SDK.

    Here is the structures of Picture (w:pict) and Drawing (w:drawing) through OpenXML SDK tool (You would find it from the installation path of OpenXML SDK, you can download here).

    You need to find all Pictures and related ImagePart. After that, deleting the picture element and following the reflect code of drawing to insert a drawing element with the specified imagepart ID.

    Hope this helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by sendreams Thursday, April 3, 2014 1:52 AM
    Wednesday, April 2, 2014 10:05 AM
  • hi, Eugene

    thank you for your time, i found a workaround way to change the type, just cut a vml and paste again, it will be change to drawingML object.

    thanks

    • Proposed as answer by George Hua Friday, April 4, 2014 1:50 AM
    • Marked as answer by George Hua Monday, April 7, 2014 5:11 PM
    Friday, April 4, 2014 1:10 AM

All replies

  • diff word intelligent menu between VML and DrawingML.

    Tuesday, April 1, 2014 3:05 AM
  • Hello sendreams,

    I'd record a macro using both images and see what object types are used for both items. May be there is a way to convert one into another using the methods provided by the Word object model.

    Tuesday, April 1, 2014 2:34 PM
  • Hi sendreams,

    Why do you want to convert VML object to DrawingML?

    In fact, both VML object and DrawingML are all InlineShape in Word, we can loop all ActiveDocument.Inlineshapes to find them. The difference is that VML is generated by dragging the picture into the document and DrawingML is generated by clicking the ribbon to insert a picture.

    Through Word Object Model, there is no direct way to convert them.

    If you insist on doing this, there is a workaround through Open XML SDK.

    Here is the structures of Picture (w:pict) and Drawing (w:drawing) through OpenXML SDK tool (You would find it from the installation path of OpenXML SDK, you can download here).

    You need to find all Pictures and related ImagePart. After that, deleting the picture element and following the reflect code of drawing to insert a drawing element with the specified imagepart ID.

    Hope this helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by sendreams Thursday, April 3, 2014 1:52 AM
    Wednesday, April 2, 2014 10:05 AM
  • hi, George

    thank you very much,

    because the drawingML presentation is word default choice and the word intelligent menu provider more function than VML.

    i know the open xml sdk and i want to find vsto equivalent api,  thank you point me the right way.

    Thursday, April 3, 2014 2:02 AM
  • hi, Eugene

    thank you for your time, i found a workaround way to change the type, just cut a vml and paste again, it will be change to drawingML object.

    thanks

    • Proposed as answer by George Hua Friday, April 4, 2014 1:50 AM
    • Marked as answer by George Hua Monday, April 7, 2014 5:11 PM
    Friday, April 4, 2014 1:10 AM