Images and Groups
Images are first-class slide elements. Use the asynchronous helper for a URL or a blob, or use 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() lists the images on the current slide. Use setSource(), setCrop(), setClipShape(), or toBuilder() to update an existing image, and use removeImage() to delete 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)}A group preserves the child order and provides 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?