Word.ImageFormat enum
表示图像格式类型。
注解
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/15-images/insert-and-get-pictures.yaml
// Gets the first image in the document.
await Word.run(async (context) => {
const firstPicture: Word.InlinePicture = context.document.body.inlinePictures.getFirst();
firstPicture.load("width, height, imageFormat");
await context.sync();
console.log(`Image dimensions: ${firstPicture.width} x ${firstPicture.height}`, `Image format: ${firstPicture.imageFormat}`);
// Get the image encoded as Base64.
const base64 = firstPicture.getBase64ImageSrc();
await context.sync();
console.log(base64.value);
});
字段
| bmp = "Bmp" | 位图图像格式。 |
| emf = "Emf" | 增强的图元文件图像格式。 |
| exif = "Exif" | Exif 图像格式。 |
| gif = "Gif" | GIF 图像格式。 |
| icon = "Icon" | 图标图像格式。 |
| jpeg = "Jpeg" | JPEG 图像格式。 |
| pdf = "Pdf" | PDF 图像格式。 |
| pict = "Pict" | PICT 图像格式。 |
| png = "Png" | PNG 图像格式。 |
| svg = "Svg" | SVG 图像格式。 |
| tiff = "Tiff" | TIFF 图像格式。 |
| undefined = "Undefined" | 未定义图像格式。 |
| unsupported = "Unsupported" | 不支持的图像格式。 |
| wmf = "Wmf" | Windows 图元文件图像格式。 |