TX Sheet Control

DrawingCollection.addPicture Method

Method

Insert an embedded picture above cells.

Owner: DrawingCollection. Package: @txtextcontrol/tx-sheet-control. Version: 2.0.0.

Syntax

addPicture(options: DrawingOptions & { source: PictureSource | string; }): Drawing

Parameters

ParameterTypeOptionalDescription
optionsDrawingOptions & { source: PictureSource | string; }NoOptional 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.

import type { Workbook } from '@txtextcontrol/tx-sheet-control';

function addSamplePicture(book: Workbook) {
    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.

See Also