Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Word.ExportOptimizeFor enum
- Package:
- word
Specifies the optimization target for document export.
Remarks
Used by
- Word.DocumentExportAsFixedFormat2Options: optimizeFor
- Word.DocumentExportAsFixedFormat3Options: optimizeFor
- Word.DocumentExportAsFixedFormatOptions: optimizeFor
Examples
// 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,
optimizeFor: Word.ExportOptimizeFor.onScreen,
};
// 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();
});
Fields
| onScreen = "OnScreen" | Optimizes for on-screen display. |
| print = "Print" | Optimizes for print. |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
Was this page helpful?
