@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
Parameter | Type |
---|---|
unitId | string |
subUnitId | string |
_injector | Injector |
Returns
Properties
Property | Modifier | Type | Defined in |
---|---|---|---|
_injector | readonly | Injector | sheets-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
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
Parameter | Type | Description |
---|---|---|
anchorType | SheetDrawingAnchorType | The anchor type SheetDrawingAnchorType |
Returns
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
Parameter | Type | Description |
---|---|---|
column | number | The sheet start column of the image |
Returns
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
Parameter | Type | Description |
---|---|---|
offset | number | The offset in pixels |
Returns
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
Parameter | Type | Description |
---|---|---|
bottom | number | The number of pixels to crop from the bottom of the image. |
Returns
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
Parameter | Type | Description |
---|---|---|
left | number | The number of pixels to crop from the left side of the image. |
Returns
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
Parameter | Type | Description |
---|---|---|
right | number | The number of pixels to crop from the right side of the image. |
Returns
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
Parameter | Type | Description |
---|---|---|
top | number | The number of pixels to crop from the top of the image. |
Returns
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
Parameter | Type | Description |
---|---|---|
height | number | The height of the image, in pixels |
Returns
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
Parameter | Type | Description |
---|---|---|
image | ISheetImage | The image to be set. ISheetImage |
Returns
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
Parameter | Type | Description |
---|---|---|
angle | number | Degree of rotation of the image, for example, 90, 180, 270, etc. |
Returns
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
Parameter | Type | Description |
---|---|---|
row | number | The sheet start row of the image |
Returns
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
Parameter | Type | Description |
---|---|---|
offset | number | The offset in pixels |
Returns
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
Parameter | Type |
---|---|
source | string |
Returns
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
Parameter | Type |
---|---|
source | string |
sourceType ? | ImageSourceType |
Returns
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
Parameter | Type |
---|---|
subUnitId | string |
Returns
setUnitId()
setUnitId(unitId): FOverGridImageBuilder
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:453
Parameters
Parameter | Type |
---|---|
unitId | string |
Returns
setWidth()
setWidth(width): FOverGridImageBuilder
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:295
set the width of the image
Parameters
Parameter | Type | Description |
---|---|---|
width | number | The width of the image, in pixels |
Returns
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]);