How to insert Header and footer data with insertooxml

Vinod Bachu 6 Reputation points
2022-06-08T16:59:38.477+00:00

I have open xml file, which has Body data, Header data and Footer data. I am trying to insert data with

context.document.body.insertOoxml(WORD_DATA, "Start"); //WORD_DATA is in XML string  
  
Or  
  
 Office.context.document.setSelectedDataAsync(WORD_DATA,{coercionType:Office.CoercionType.Ooxml},(res)=>{  
         console.log(res);  
 })  

In both cases body data only inserting but not Header and footer. How to extract Header and Footer in the respective sections

I tried this also

 var myFooter = mySections.items[0].getFooter(Word.HeaderFooterType.primary);  
              
 myFooter.insertOoxml(WORD_DATA, Word.InsertLocation.end);  

In this case also inserting Body data only. How to insert Header and Footer data from XML string

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
449 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
1,977 questions
Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
780 questions
No comments
1 vote