Create and update custom xml part

Home Forums Open-Xml-Sdk-JavaScript Create and update custom xml part

This topic contains 2 replies, has 3 voices, and was last updated by  linzhixiang2017 7 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3584

    vimalkumarsinghal
    Participant

    Hi,

    I am using office js and open xml js. I would like to know is it possible to read and update custom item xml on the open document.

    Using Office.context.document.customXmlParts.getByNamespaceAsync i was able to read the xml. Can i achieve the similar behavior using open xml.js.

    Thanks
    Vimal

    #3594

    Eric White
    Keymaster

    Hi Vimal,

    This is certainly doable. The Open-Xml-Sdk-Js is somewhat similar to the classes in System.IO.Packaging, in that you can create any variety of part, with any content type, and create a relationship to that part from the main document, or from any other part.

    You have to remember that when creating a custom XML part, you must actually create two parts – there is the part that contains your XML, and that part has a relationship to a properties part. Take a look at a document that contains a custom XML part using the Open XML Package Editor in Visual Studio, in order to see the content type for the custom XML part, and the content type for the properties part, and the various relationship types. Then your job in the Open-Xml-Sdk-JavaScript is to create those same parts, with the same content types, and with relationships with the same relationship types.

    -Eric

    #4420

    linzhixiang2017
    Participant
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.