Open XML replacing Office.Intelop classes RRS feed

  • Question

  • Hello,

    I am really new with shapes and formats. I have to delete from our Project all



    We muste use the Open Xml SDK and I added the Reference: 

    using DocumentFormat.OpenXml.Office2013.Word;

    I have this code and I have no clue how to change it. My impression is, that Open XML does not support 

    Range, InlineShape, WdInlineShapeType

    The code is:

    InlineShape currentShape = myRange.InlineShapes[i];               

    Range currentShapeRange = currentShape.Range;               

    WdInlineShapeType typeOfCurrentShape = currentShape.Type;               

    if (typeOfCurrentShape != WdInlineShapeType.wdInlineShapeEmbeddedOLEObject)

    Is there anyway to replace the code above using Open XML functions/classes? 

    Thank you for your help!!!

    Sunday, May 7, 2017 10:13 PM

All replies

  • Hello,

    Open XML and Office Interop are totally different. Open XML doesn't support Range, InlineShape, WdInlineShapeType

    To manipulate office documents using Open XML library, I would suggest you download Open XML SDK Tool.

    You could open a document and select the xml and then Reflect code, then you could check the namespaces/classes/properties and methods it uses.

    You could also compare documents and generate code.

    1. Create two documents with one is original file and one is the target file.

    2. Use Open XML SDK 2.5 productivity Tool for Microsoft Office.

    3. Click the Compare Files, generate the code, and then you could get the code what you want.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, May 8, 2017 3:26 AM