none
How to convert OpenXmlElement object to Stream RRS feed

  • Question

  • Hi,

    I am need to convert a OpenXmlElement object to a Stream. Is there any safer way to do this? Can anyone give me a help.

    Regards,

    Vins

    Hint: I was tried BinaryFormater with MemoryStream but since the OpenXmlElement is not seriaizeble, cannot perform this. 


    - Vins

    Monday, October 22, 2012 2:34 PM

Answers

  • Hi Tom,

    I resolved my problem. Actually what I wanted was, get the Stream of an embedded object which is added to a Docx file. So, I thought "EmbeddedObject" having the Stream but NOT. The actual scenario is, when a object is added to Docx as a embedded object, the object’s Stream saved in “EmbededObjectPart” but not in “EmbeddedObject”.

    So, it easy to get the Stream from "EmbeddedObjectPart".

    So, thought my question is not answered (question is different than what I need) and since I got a solution for my problem, we can end this conversation.

    Regards,

    Vins

    BTW, if you need more info, I can contact you via MS internal Lync communicator, I too a MS :). just let me know your are "v-" or not since two Tom's are there.


    - Vins


    Tuesday, October 23, 2012 8:11 AM

All replies

  • Hi Vins,

    Thanks for posting in the MSDN Forum.

    I think you need clarify your goal more detailed.

    As far as I know Element is a kind of formatted text of the xml file. I think it is simple to convert string to Stream. Would you access the text information from OuterXml property. I’m also curious with which Open xml Node which you want to convert.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, October 23, 2012 2:04 AM
    Moderator
  • Hi Tom,

    Thanks for replying me.

    I am parsing Docx files using OOXML SDK, so when ever if I found an "EmbeddedObject" object (it's a OpenXmlElement) inside Docx, I need to convert it to a Stream and pass to another flow.

    (I am not and I dont need to access text or Inner XML, just convert the object to Stream)

    Hope I explains but Please let me know if any more should require.

    Thanks again,

    Vins


    - Vins

    Tuesday, October 23, 2012 3:57 AM
  • Hi Tom,

    I resolved my problem. Actually what I wanted was, get the Stream of an embedded object which is added to a Docx file. So, I thought "EmbeddedObject" having the Stream but NOT. The actual scenario is, when a object is added to Docx as a embedded object, the object’s Stream saved in “EmbededObjectPart” but not in “EmbeddedObject”.

    So, it easy to get the Stream from "EmbeddedObjectPart".

    So, thought my question is not answered (question is different than what I need) and since I got a solution for my problem, we can end this conversation.

    Regards,

    Vins

    BTW, if you need more info, I can contact you via MS internal Lync communicator, I too a MS :). just let me know your are "v-" or not since two Tom's are there.


    - Vins


    Tuesday, October 23, 2012 8:11 AM
  • Hi Vins007,

    I'm glad to hear you have solved your issue. Thanks for share your experience here, it will help other community members who have similar problem like you to see how to solve it.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, October 25, 2012 5:57 AM
    Moderator