Office.FileType enum
Specifies the format in which to return the document.
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/get-file-as-pdf.yaml
Office.context.document.getFileAsync(Office.FileType.Pdf, (result) => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.error("getFileAsync failed:", result.error);
} else {
const myFile = result.value;
const sliceCount = myFile.sliceCount;
console.log("File size:" + myFile.size + " #Slices: " + sliceCount);
// Get the file slices.
const docDataSlices = [];
let slicesReceived = 0,
gotAllSlices = true;
getSliceAsync(myFile, 0, sliceCount, gotAllSlices, docDataSlices, slicesReceived);
myFile.closeAsync();
}
});
Fields
| Compressed | Returns the entire document (.pptx, .docx, .xlsx, or .xlsm) in Office Open XML (OOXML) format as a byte array. Note: The .xslm file type is supported in Excel on Windows and Mac. It's not supported in Excel on the web. In Excel on Windows, the file slices from the |
Returns the entire document in PDF format as a byte array. |
|
| Text | Returns only the text of the document as a string. |