Office.FileType enum

ドキュメントを返す形式を指定します。

注釈

使用元

// 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();
  }
});

フィールド

Compressed

ドキュメント全体 (.pptx、.docx、.xlsx、または .xlsm) を Office Open XML (OOXML) 形式でバイト配列として返します。

注: Windows および Mac の Excel では、.xslm ファイルの種類がサポートされています。 これは、Excel on the web ではサポートされていません。 Windows 上の Excel では、 getFileAsync メソッドからのファイル スライスには、.xslm ファイルの種類の VBA 署名ファイルが含まれます。 VBA 署名ファイルは、vbaProjectSignature.bin、vbaProbjectSignatureAgile.bin、および vbaProjectSignatureV3.bin です。 Mac 上の Excel では、 getFileAsync メソッドからのファイル スライスには VBA 署名ファイルは含まれません。これは、このプラットフォームが VBA 署名機能をサポートしていないためです。

Pdf

Office.FileType.Text

Text

ドキュメントのテキストのみを文字列として返します。