Excel.PictureFormat enum
The format of the image.
TypeScript
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/44-shape/shape-images.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Shapes");
const shape = sheet.shapes.getItem("Image");
const result = shape.getAsImage(Excel.PictureFormat.png);
await context.sync();
const imageString = result.value;
// Your add-in would save this string as a .png file.
console.log("The image's Base64-encoded string: " + imageString);
});
bmp = "BMP" | Bitmap image. |
gif = "GIF" | Graphics Interchange Format. |
jpeg = "JPEG" | Joint Photographic Experts Group. |
png = "PNG" | Portable Network Graphics. |
svg = "SVG" | Scalable Vector Graphic. |
unknown = "UNKNOWN" |
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
Office Add-ins is an open source project. Select a link to provide feedback: