Created
June 9, 2017 20:49
-
-
Save pdbradley/394f63d911cd82863876601813eb4b0a to your computer and use it in GitHub Desktop.
getFileAsync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetDocumentAsPdf(){ | |
Office.context.document.getFileAsync(Office.FileType.Pdf, {sliceSize: 65536}, | |
function (result) { | |
if (result.status == "succeeded") { | |
// If the getFileAsync call succeeded, then | |
// result.value will return a valid File Object. | |
var myFile = result.value; | |
var sliceCount = myFile.sliceCount; | |
var slicesReceived = 0, gotAllSlices = true, docdataSlices = []; | |
//app.showNotification("File size:" + myFile.size + " #Slices: " + sliceCount); | |
console.log("File size:" + myFile.size + " #Slices: " + sliceCount); | |
// Get the file slices. | |
getSliceAsync(myFile, 0, sliceCount, gotAllSlices, docdataSlices, slicesReceived); | |
} | |
else { | |
//app.showNotification("Error:", result.error.message); | |
console.log("Error:" + result.error.message); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment