Images and Groups
Images are first-class slide elements. Use the asynchronous helper for a URL or blob, or the builder when all image properties are already known.
Insert an image
TypeScript
const slide = univerAPI.getActivePresentation()?.getActiveSlide()if (!slide) { throw new Error('No active slide')}const image = await slide.insertImageAsync( 'https://example.com/assets/diagram.png', { imageSourceType: univerAPI.Enum.ImageSourceType.URL, left: 80, top: 120, width: 320, height: 180, })getImages() returns the images on the current slide. Use setSource(), setCrop(), setClipShape(), or toBuilder() to update an existing image, and removeImage() to remove it.
Group elements
TypeScript
const shape = slide.getShapes()[0]if (shape) { const group = slide.group([shape, image]) const children = group.getChildren() // Restore the children to the slide. slide.ungroup(group)}Groups preserve child order and expose the same transform, visibility, name, and description methods as other page elements. getGroups() lists the top-level groups on a slide.
How is this guide?