How word store all the inlineshapes? RRS feed

  • Question

  • Now I am working on a word add-in for Team fundation server. But first how word manage there shapes (chart, pic...), it looks like they are all in a collection. I want to get the position of them, is it the "shape.range"? I just want to insert a guid number in there.
    foreach (Word.InlineShape shape in VstoDocument.InlineShapes)
    secondly, does someone know how can I transform the shape type to a tfs attachment type? anything is cool (docx, jpg, png...)
    Tuesday, July 19, 2011 12:38 PM


  • Hi Winzhao

    I'm not certain I follow all the ins-and-outs of your scenario but...

    Word stores graphics in two possible collections: Shapes and InlineShapes. Shapes have text-flow formatting (text wraps around); InlineShapes are treated like text characters within the text flow. Possibly, you may need to check both collections.

    Could you be more specific about the "position" information you need? A Shape will give you a left/top but an InlineShape will not. An InlineShape has a Range (and a Shape does not).

    Could you also please be more specific about what should happen with this GUID number? Should it replace the graphic? Be superimposed on it? Be placed beside it? Something else...?

    Word has no facility for exporting graphical content. There are some possible workarounds, but it will depend very much on which version of Word you're targeting, which you unfortunately do not mention. It would also help to understand the workflow on the documents your add-in will be working with.

    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Winzhao Monday, July 25, 2011 4:58 AM
    Tuesday, July 19, 2011 12:51 PM