Back to Devexpress

IInsertedInlineImageOptions Interface

aspnetcore-js-devexpress-dot-richedit-5688c37e.md

latest3.8 KB
Original Source

IInsertedInlineImageOptions Interface

Declares settings of an inline image.

Declaration

ts
export interface IInsertedInlineImageOptions

Remarks

The inline image settings are used in the createInline(position, options) method.

The example below demonstrates how to create an inline image with the specified settings in the document, and add a figure caption field and image description below the image.

javascript
var imgUrl = 'your-image-URL';
var size = new DevExpress.RichEdit.Size(richEdit.unitConverter.centimetersToTwips(12), 
    richEdit.unitConverter.centimetersToTwips(8));
var imgDescription = 'An image';
// adds a figure caption and image description below the image
function insertImageDescription(img){
    richEdit.document.insertParagraph(img.interval.start);
    var positionAfterImg = img.interval.start + 2;
    richEdit.document.insertParagraph(positionAfterImg);
    richEdit.document.insertText(positionAfterImg, ' ' + img.description);
    richEdit.selection.setSelection(positionAfterImg);
    richEdit.executeCommand(DevExpress.RichEdit.ReferencesTabCommandId.CreateFigureCaptionField);
    richEdit.document.insertParagraph(positionAfterImg);
};
richEdit.document.images.createInline(richEdit.selection.active, {
    url: imgUrl, 
    actualSize: size, 
    description: imgDescription, 
    callback: insertImageDescription
});

Properties

actualSize Property

Specifies the actual size of an inline image in the document.

Declaration

ts
actualSize: Size

Property Value

TypeDescription
Size

An object that contains an image size, in twips.

|

Remarks

javascript
var imgUrl = 'your-image-URL';
var size = new DevExpress.RichEdit.Size(richEdit.unitConverter.centimetersToTwips(12), 
    richEdit.unitConverter.centimetersToTwips(8));
richEdit.document.images.createInline(richEdit.selection.active, {url: imgUrl, actualSize: size});

base64 Property

The image content that is encoded with base64 digits.

Declaration

ts
base64?: string

Property Value

TypeDescription
string

The image content.

|

callback Property

Specifies a function that is called after an image is loaded to the document.

Declaration

ts
callback?: (image: InlineImage) => void

Property Value

TypeDescription
(image: InlineImage) => void

The function. The image parameter returns the newly created image.

|

Remarks

javascript
richEdit.document.images.createInline(richEdit.selection.active, {
    url: 'your-image-URL', description: 'An image',
    callback: (function(img){console.log('The following image has been added: '+ img.description)})});

description Property

Specifies an image description.

Declaration

ts
description?: string

Property Value

TypeDescription
string

The description.

|

Remarks

javascript
richEdit.document.images.createInline(richEdit.selection.active, {
  url: 'your-image-URL', 
  description: 'An image'
});

url Property

Specifies the image URL.

Declaration

ts
url?: string

Property Value

TypeDescription
string

The image URL.

|

Remarks

javascript
richEdit.document.images.createInline(richEdit.selection.active, {
  url: 'your-image-URL'
});