次の方法で共有


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

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

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

Pdf

Office.FileType.Text

Text

文書のテキストのみを文字列として返します。