ReplaceCurrentImage
Replaces the current image with an image specified.
Parameters:
Name |
Type |
Description |
sImageUrl |
string
|
The image source where the image to be inserted should be taken from (currently, only internet URL or Base64 encoded images are supported). |
Width |
EMU
|
The image width in English measure units. |
Height |
EMU
|
The image height in English measure units. |
Returns:
-
This method doesn't return any data.
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oDrawing = Api.CreateImage("https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", 60 * 36000, 35 * 36000);
oParagraph.AddDrawing(oDrawing);
oDrawing.Select();
oDocument.ReplaceCurrentImage("https://helpcenter.onlyoffice.com/images/Help/GettingStarted/Documents/big/EditDocument.png", 60 * 36000, 35 * 36000);
builder.SaveFile("docx", "ReplaceCurrentImage.docx");
builder.CloseFile();
Resulting document