Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

350
Views
Microsoft Word API - how to I from Word.RequestContext.document to Office.Document

I am starting the "Build your first Word task pane add-in" tutorial.

Basically I want to make a Button on the Panel that will send this document as a PDF to my web service.

There is a function in the API called Office.Document.getFileAsync which seem to be an excellent way to save data to a PDF, which I can then send to my web service.

How do I access that part of the API. In the tutorial it seem that we should use the context object, but context.document.getFileAsync does not appear to exist. I think I need to get to the Office.Document object and I think context.document is Word.RequestContext.document.

export async function run() {
  return Word.run(async (context) => {
    /**
     * Insert your Word code here
     */

    {{Office.Document then use getFileAsync  }}

    await context.sync();
  });
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There are two different branches to the Office JavaScript library. There are the Common APIs which apply, theoretically, to any Office application. There are also the application-specific APIs that apply to just one Office application. There are application-specific APIs for Word, Excel, and PowerPoint, among others. The Word tutorial uses the Word application-specific APIs because that is the set of APIs that is most often used. However, for what you want to do, you should use the Common APIs. Specifically, the one that you discovered, Office.document.getFileAsync.

You can find code samples that use Office.document.getFileAsync in Get the whole document from an add-in in Word. Also, checkout Office JavaScript API object model.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!