DrawingCollection.addPicture Method
Insert an embedded picture above cells.
Owner: DrawingCollection. Package: @txtextcontrol/tx-sheet-control. Version: 2.0.0.
Syntax
owner.addPicture(options)
Parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
options | DrawingOptions & { source: PictureSource | string; } | No | Optional settings validated before the operation is applied. |
Return Value
Drawing.
A detached result or a handle bound to the same worksheet.
Examples
This example embeds a tiny PNG. Replace its data URL with your own supported image content.
function addSamplePicture(book) {
const sheet = book.sheets.at(0);
sheet.drawings.addPicture({
source: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jRZkAAAAASUVORK5CYII=',
anchor: { cell: 'F2' },
size: { width: 32, height: 32 },
});
}
Remarks
Use this member on an object from the current document. Reacquire document-bound handles after replacement/deletion. Validate arguments against the declared types and documented bounds; handle exceptions or rejected promises.