Office.context.document.getFileAsync is not working for office online in word application RRS feed

  • Question

  • Hi,

    We are undergoing the development of an add-in of Office 365. Its hosts are word and power-point. We are almost done with its development and tested it on different versions of desktop clients and in live office for mac and windows as well. It is working perfectly fine everywhere but behaving abnormally only in live office on windows. And to be very precise it abends in word online. After digging into the problem we pin point the root cause which is this statement of a microsoft built-in library called office.js

    Office.context.document.getFileAsync("pdf", { sliceSize: 65536 }, function (fileResult) {

    When we use our add-in for word online debugger go to execute this call, it stuck somewhere and respond nothing. In powerpoint online it works perfect and on mac online and all desktop clients it works for both hosts perfectly.

    On seeking help from microsoft documentation I came accross this link:

    which shows that "Y" is missing against Word - Office Online (in browser). I perceive it as root cause of our problem.

    Please let me know either our assumption is right or not?

    If it is right then give some resolution to this problem. Is there some solid solution or way around available to solve this issue as soon as possible.

    We had plan to release our add-in last week but we are stuck just because of this.

    Kindly assist on this.


    Azhar Majeed
    • Moved by Sabah ShariqMVP Monday, October 2, 2017 9:11 AM Moved From Visual C#
    Monday, October 2, 2017 5:28 AM

All replies

  • Hello Azhar,

    According to

    fileType Value

    Host Supported fileType
    Excel Online, Win32, Mac and iOS Office.FileType.Compressed
    PowerPoint on Windows desktop, Mac, and iPad and PowerPoint Online Office.FileType.Compressed, Office.FileType.Pdf
    Word on Windows desktop, Word on Mac and Word Online Office.FileType.Compressed, Office.FileType.Pdf, Office.FileType.Text

    Word on iPad|Office.FileType.Compressed, Office.FileType.Text|

    So Office.FileType.Pdf is supported in Word Online.

    And the following code works for me. I add a breakpoint to check the result status. It shows successfully to get the file in PDF.  Please test if the code works for you.

     function downloadPDF() {
   (context) {
                // Synchronize the document state by executing the queued commands, and return a promise to indicate task completion.
                return context.sync()
                    .then(function () {
                            function (result) {
                                if (result.status == "succeeded") {
                                    var myFile = result.value;
                                    var sliceCount = myFile.sliceCount;
                                    showNotification("File size:" + myFile.size + " #Slices: " + sliceCount);
                                    // Now, you can call getSliceAsync to download the files, as described in the previous code segment (compressed format).
                                else {
                                    showNotification("Error:", result.error.message);



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, October 2, 2017 10:07 AM