none
Get Open XML for complete document using Javascript API RRS feed

  • Question

  • Hi,

    I am creating an add-in for Word using Javascript API.

    I am able to get Open Office XML for body using context.document.body.getOoxml();
    But I also want to get Open XML for headers and footers.

    I can get the Open XML by querying

    context.document.sections.getFirst().getHeader("primary") //"firstpage", "evenpage"

    As I want open XML from all headers and all footers I need to write six different calls

    context.document.sections.getFirst().getHeader("primary")

    context.document.sections.getFirst().getHeader("firstPage")

    context.document.sections.getFirst().getHeader("evenPages")

    context.document.sections.getFirst().getFooter("primary")

    context.document.sections.getFirst().getFooter("firstpage")

    context.document.sections.getFirst().getFooter("evenPages")But this is very slow(Takes around 20-30 secs to execute)
    Is there any way I can get complete OOXML by just making a single call?
    Or any other way to make the above approach faster?

    Thanks,
    Abhijeet

    Thursday, August 16, 2018 6:37 AM

Answers

  • You might want to ask this on Stack Overflow, in the office-js tag. That's where the Microsoft team for the JS APIs hang out (when they have time).

    FWIW I believe this is the only possibility using the JS APIs. With the COM interop object model it's different (although the WordOpenXML that's returned for Document.Content is incomplete compared to what you get when the closed document is used). I suspect the JS team designed it like this to reduce the content that's returned since the entire document can be very, very large.


    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    Sunday, August 19, 2018 11:14 AM
    Moderator