次の方法で共有


Word.ExportItem enum

Word ドキュメントのエクスポート項目の種類を指定します。

注釈

[ API set: WordApiDesktop 1.4 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/export.yaml

await Word.run(async (context) => {
  const document: Word.Document = context.document;

  // Export the current document as a PDF saved in your default location, usually Documents.
  const filename = `exported-doc-${getCurrentDate()}.pdf`;
  console.log(`File name: ${filename}`);
  const options: Word.DocumentExportAsFixedFormatOptions = {
    item: Word.ExportItem.documentContent,
    openAfterExport: true,
  };

  // If a file with the same name already exists at the default location, it's silently overwritten.
  document.exportAsFixedFormat(filename, Word.ExportFormat.pdf, options);

  await context.sync();
});

フィールド

documentContent = "DocumentContent"

ドキュメント コンテンツのみをエクスポートします。

documentWithMarkup = "DocumentWithMarkup"

マークアップ (注釈) を含むドキュメントをエクスポートします。