none
Embeed OLE object in OpenXml RRS feed

  • Question

  • I have the Ole object which I want to insert in DOCX. This ole can be of any file.
    So how can I do this? I mean if Ole is made up from .gif.....Ole should be embed in DOCX as Gif......


    A person who never made a mistake never tried anything new.
    Monday, March 2, 2009 9:08 AM

Answers

  • Hi prpradip,

    I see you want to embed a OleObject with image in it, is that right?
    You can firstly accomplish this via UI and leverage Document Reflector to see the corresponding C# code.
    Here's several things you should do in my opinion:
    1. MainDocumentPart.AddNewPart<EmbeddedObjectPart>("application/vnd.openxmlformats-officedocument.oleObject", relationshipId);
    2. Feed data into the OleObjectp.
    3. MainDocumentPart.AddNewPart<ImagePart>("image/x-wmf",  relationshipId);
    4. Feed data into the ImagePart
    5. Others

    Please update me if it works for you, thanks:)

    • Marked as answer by cissharp Tuesday, July 7, 2009 6:05 AM
    Tuesday, May 12, 2009 3:19 AM

All replies

  • Hi,
    I am not clear about what you want..
    You can just use o:OLEObjectto to insert gif file as embedded object in DOCX

    Wednesday, March 4, 2009 7:17 AM
  • Hi prpradip,

    I see you want to embed a OleObject with image in it, is that right?
    You can firstly accomplish this via UI and leverage Document Reflector to see the corresponding C# code.
    Here's several things you should do in my opinion:
    1. MainDocumentPart.AddNewPart<EmbeddedObjectPart>("application/vnd.openxmlformats-officedocument.oleObject", relationshipId);
    2. Feed data into the OleObjectp.
    3. MainDocumentPart.AddNewPart<ImagePart>("image/x-wmf",  relationshipId);
    4. Feed data into the ImagePart
    5. Others

    Please update me if it works for you, thanks:)

    • Marked as answer by cissharp Tuesday, July 7, 2009 6:05 AM
    Tuesday, May 12, 2009 3:19 AM