Word.ImageFormat enum
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Remarks
[ API set: WordApi BETA (PREVIEW ONLY) ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-get-pictures.yaml
// Gets the first image in the document.
await Word.run(async (context) => {
const firstPicture = context.document.body.inlinePictures.getFirst();
firstPicture.load("width, height, imageFormat");
await context.sync();
console.log(`Image dimensions: ${firstPicture.width} x ${firstPicture.height}`);
console.log(`Image format: ${firstPicture.imageFormat}`);
// Get the image encoded as Base64.
const base64 = firstPicture.getBase64ImageSrc();
await context.sync();
console.log(base64.value);
});
Fields
bmp = "Bmp" | |
emf = "Emf" | |
exif = "Exif" | |
gif = "Gif" | |
icon = "Icon" | |
jpeg = "Jpeg" | |
pdf = "Pdf" | |
pict = "Pict" | |
png = "Png" | |
svg = "Svg" | |
tiff = "Tiff" | |
undefined = "Undefined" | |
unsupported = "Unsupported" | |
wmf = "Wmf" |
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
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for