@univerjs/sheets-drawing-ui v0.5.4


Class: FOverGridImage

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

FBase is a base class for all facade classes. It provides a way to extend classes with static and instance methods. The _initialize as a special method that will be called after the constructor. You should never call it directly.

Extends

Constructors

new FOverGridImage()

new FOverGridImage(
   _image, 
   _commandService, 
   _injector): FOverGridImage

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

Parameters

ParameterType
_imageISheetImage
_commandServiceICommandService
_injectorInjector

Returns

FOverGridImage

Overrides

FBase.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_commandServicereadonlyICommandServiceundefined-sheets-drawing-ui/src/facade/f-over-grid-image.ts:493
_disposedprotectedbooleanfalseFBase._disposedcore/src/shared/lifecycle.ts:96
_injectorreadonlyInjectorundefined-sheets-drawing-ui/src/facade/f-over-grid-image.ts:494

Methods

dispose()

dispose(): void

Defined in: core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FBase.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FBase.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FBase.ensureNotDisposed


getId()

getId(): string

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

Returns

string


getType()

getType(): DrawingTypeEnum

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

Returns

DrawingTypeEnum


remove()

remove(): boolean

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

Remove the image from the sheet

Returns

boolean

success or not

Example

// remove the image from the sheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Delete state is ', image?.remove());

setBack()

setBack(): boolean

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

Move the image layer to the back

Returns

boolean

success or not

Example

// move the image to the back
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move back state is ', image.setBack());

setBackward()

setBackward(): boolean

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

Move the image layer backward by one level

Returns

boolean

success or not

Example

// move the image backward
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move backward state is ', image.setBackward());

setCrop()

setCrop(
   top?, 
   left?, 
   bottom?, 
   right?): boolean

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

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

Parameters

ParameterTypeDescription
top?numberThe number of pixels to crop from the top of the image.
left?numberThe number of pixels to crop from the left side of the image.
bottom?numberThe number of pixels to crop from the bottom of the image.
right?numberThe number of pixels to crop from the right side of the image.

Returns

boolean

success or not

Example

// set the crop of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set crop state is ', image.setCrop(10, 10, 10, 10));

setForward()

setForward(): boolean

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

Move the image layer forward by one level

Returns

boolean

success or not

Example

// move the image forward
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move forward state is ', image.setForward());

setFront()

setFront(): boolean

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

Move the image layer to the front

Returns

boolean

success or not

Example

// move the image to the front
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move front state is ', image.setFront());

setPositionAsync()

Call Signature

setPositionAsync(row, column): Promise<boolean>

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

Set the position of the image

Parameters
ParameterTypeDescription
rownumberThe sheet start row of the image
columnnumberThe sheet start column of the image
Returns

Promise<boolean>

success or not

Example
 // set the position of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set position state is ', image.setPosition(5, 5));

Call Signature

setPositionAsync(
   row, 
   column, 
   rowOffset?, 
columnOffset?): Promise<boolean>

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

Parameters
ParameterTypeDescription
rownumberThe sheet start row of the image
columnnumberThe sheet start column of the image
rowOffset?numberThe offset of the start row
columnOffset?numberThe offset of the start column
Returns

Promise<boolean>

success or not

Example
// set the position of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set position state is ', image.setPosition(5, 5, 10, 10));

setRotate()

setRotate(angle): boolean

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

Set the rotation angle of the image

Parameters

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

Returns

boolean

success or not

Example

// set the rotation angle of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set rotate state is ', image.setRotate(90));

setSizeAsync()

setSizeAsync(width, height): Promise<boolean>

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

Set the size of the image

Parameters

ParameterTypeDescription
widthnumberThe width of the image
heightnumberThe height of the image

Returns

Promise<boolean>

success or not

Example

// set the size of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set size state is ', image.setSize(50, 120));
 
***
 
### setSource()
 
#### Call Signature
 
```ts
setSource(source): boolean

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

Set the source of the image

Parameters
ParameterTypeDescription
sourcestringThe source of the image
Returns

boolean

success or not

Example
// set the source of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set source state is ', image.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4'));
 
#### Call Signature
 
```ts
setSource(source, sourceType?): boolean

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

Set the source of the image, change image display.

Parameters
ParameterTypeDescription
sourcestringThe source of the image
sourceType?ImageSourceTypeThe source type of the image, ImageSourceType
Returns

boolean

success or not


toBuilder()

toBuilder(): FOverGridImageBuilder

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

Convert the image to a FOverGridImageBuilder

Returns

FOverGridImageBuilder

The builder FOverGridImageBuilder

Example

// convert the image to a builder
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
const builder = image.toBuilder();
const param = await builder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).buildAsync();
activeSheet.updateImages([param]);

extend()

static extend(source): void

Defined in: core/src/facade/f-base.ts:26

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FBase.extend