@univerjs/sheets-drawing-ui v0.5.4


Class: FOverGridImageBuilder

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:100

Constructors

new FOverGridImageBuilder()

new FOverGridImageBuilder(
   unitId, 
   subUnitId, 
   _injector): FOverGridImageBuilder

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:102

Parameters

ParameterType
unitIdstring
subUnitIdstring
_injectorInjector

Returns

FOverGridImageBuilder

Properties

PropertyModifierTypeDefined in
_injectorreadonlyInjectorsheets-drawing-ui/src/facade/f-over-grid-image.ts:105

Methods

buildAsync()

buildAsync(): Promise<ISheetImage>

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:463

Returns

Promise<ISheetImage>


getsource()

getsource(): string

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:197

Returns

string


getSourceType()

getSourceType(): ImageSourceType

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:201

Returns

ImageSourceType


setAnchorType()

setAnchorType(anchorType): FOverGridImageBuilder

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:333

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:219

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:257

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:392

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:372

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:412

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:352

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:314

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:146

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:443

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:238

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:276

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:188

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:189

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

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:458

Parameters

ParameterType
subUnitIdstring

Returns

FOverGridImageBuilder


setUnitId()

setUnitId(unitId): FOverGridImageBuilder

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:453

Parameters

ParameterType
unitIdstring

Returns

FOverGridImageBuilder


setWidth()

setWidth(width): FOverGridImageBuilder

Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:295

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]);