Skip to Content
ClassesFOverGridImageBuilder

Class: FOverGridImageBuilder

Methods

buildAsync()

buildAsync(): Promise<ISheetImage>

Returns

Promise<ISheetImage>


getsource()

getsource(): string

Returns

string


getSourceType()

getSourceType(): ImageSourceType

Returns

ImageSourceType


setAnchorType()

setAnchorType(anchorType): FOverGridImageBuilder

Set the anchor type of the image, whether the position and size change with the cell

Parameters

ParameterTypeDescription
anchorTypeSheetDrawingAnchorTypeThe anchor type SheetDrawingAnchorType

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setAnchorType(univerAPI.Enum.SheetDrawingAnchorType.None).buildAsync(); activeSheet.insertImages([param]);

setColumn()

setColumn(column): FOverGridImageBuilder

Set the position of the image

Parameters

ParameterTypeDescription
columnnumberThe sheet start column of the image

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).buildAsync(); activeSheet.insertImages([param]);

setColumnOffset()

setColumnOffset(offset): FOverGridImageBuilder

Set the column offset of the image in a unit

Parameters

ParameterTypeDescription
offsetnumberThe offset in pixels

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setColumnOffset(10).setRowOffset(10).buildAsync(); activeSheet.insertImages([param]);

setCropBottom()

setCropBottom(bottom): FOverGridImageBuilder

Set the cropping region of the image by defining the bottom edges, thereby displaying the specific part of the image you want.

Parameters

ParameterTypeDescription
bottomnumberThe number of pixels to crop from the bottom of the image.

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setCropTop(10).setCropLeft(10).setCropBottom(10).setCropRight(10).buildAsync(); activeSheet.insertImages([param]);

setCropLeft()

setCropLeft(left): FOverGridImageBuilder

Set the cropping region of the image by defining the left edges, thereby displaying the specific part of the image you want.

Parameters

ParameterTypeDescription
leftnumberThe number of pixels to crop from the left side of the image.

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setCropTop(10).setCropLeft(10).setCropBottom(10).setCropRight(10).buildAsync(); activeSheet.insertImages([param]);

setCropRight()

setCropRight(right): FOverGridImageBuilder

Set the cropping region of the image by defining the right edges, thereby displaying the specific part of the image you want.

Parameters

ParameterTypeDescription
rightnumberThe number of pixels to crop from the right side of the image.

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setCropTop(10).setCropLeft(10).setCropBottom(10).setCropRight(10).buildAsync(); activeSheet.insertImages([param]);

setCropTop()

setCropTop(top): FOverGridImageBuilder

Set the cropping region of the image by defining the top edges, thereby displaying the specific part of the image you want.

Parameters

ParameterTypeDescription
topnumberThe number of pixels to crop from the top of the image.

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setCropTop(10).setCropLeft(10).setCropBottom(10).setCropRight(10).buildAsync(); activeSheet.insertImages([param]);

setHeight()

setHeight(height): FOverGridImageBuilder

Set the height of the image

Parameters

ParameterTypeDescription
heightnumberThe height of the image, in pixels

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setWidth(120).setHeight(50).buildAsync(); activeSheet.insertImages([param]);

setImage()

setImage(image): FOverGridImageBuilder

Set the initial image configuration for the image builder.

Parameters

ParameterTypeDescription
imageISheetImageThe image to be set. ISheetImage

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setImage({ drawingId: '123456', drawingType: univerAPI.Enum.DrawingType.DRAWING_IMAGE, imageSourceType: univerAPI.Enum.ImageSourceType.BASE64, source: 'https://avatars.githubusercontent.com/u/61444807?s=48&v=4', unitId: activeSpreadsheet.getId(), subUnitId: activeSheet.getSheetId(), }).setColumn(5).setRow(5).buildAsync(); activeSheet.insertImages([param]);

setRotate()

setRotate(angle): FOverGridImageBuilder

Set the rotation angle of the image

Parameters

ParameterTypeDescription
anglenumberDegree of rotation of the image, for example, 90, 180, 270, etc.

Returns

FOverGridImageBuilder

The builder FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setRotate(90).buildAsync(); activeSheet.insertImages([param]);

setRow()

setRow(row): FOverGridImageBuilder

Set the position of the image

Parameters

ParameterTypeDescription
rownumberThe sheet start row of the image

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).buildAsync(); activeSheet.insertImages([param]);

setRowOffset()

setRowOffset(offset): FOverGridImageBuilder

Set the row offset of the image in a unit

Parameters

ParameterTypeDescription
offsetnumberThe offset in pixels

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setColumnOffset(10).setRowOffset(10).buildAsync(); activeSheet.insertImages([param]);

setSource()

Call Signature

setSource(source): FOverGridImageBuilder

Set the unit id of the image

Parameters
ParameterType
sourcestring
Returns

FOverGridImageBuilder

The builder

Example
// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).buildAsync(); activeSheet.insertImages([param]);

Call Signature

setSource(source, sourceType?): FOverGridImageBuilder

Set the unit id of the image

Parameters
ParameterType
sourcestring
sourceType?ImageSourceType
Returns

FOverGridImageBuilder

The builder

Example
// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).buildAsync(); activeSheet.insertImages([param]);

setSubUnitId()

setSubUnitId(subUnitId): FOverGridImageBuilder

Parameters

ParameterType
subUnitIdstring

Returns

FOverGridImageBuilder


setUnitId()

setUnitId(unitId): FOverGridImageBuilder

Parameters

ParameterType
unitIdstring

Returns

FOverGridImageBuilder


setWidth()

setWidth(width): FOverGridImageBuilder

set the width of the image

Parameters

ParameterTypeDescription
widthnumberThe width of the image, in pixels

Returns

FOverGridImageBuilder

The builder. FOverGridImageBuilder

Example

// create a new image builder. const activeSpreadsheet = univerAPI.getActiveWorkbook(); const activeSheet = activeSpreadsheet.getActiveSheet(); const imageBuilder = activeSheet.newOverGridImage(); const param = await imageBuilder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).setWidth(120).setHeight(50).buildAsync(); activeSheet.insertImages([param]);