Get Started
Documentation

ApiDrawing

new ApiDrawing()

Class representing a graphical object.

Methods

Name Description
GetClassType Get the type of the class based on this base class.
SetDistances Specify the minimum distance which will be maintained between the edges of this drawing object and any subsequent text.
SetHorAlign Specify how the floating object will be horizontally aligned.
SetHorPosition Set an absolute measurement for the horizontal positioning of the floating object.
SetSize Set the size of the object (image, shape, chart) bounding box.
SetVerAlign Specify how the floating object will be vertically aligned.
SetVerPosition Set an absolute measurement for the vertical positioning of the floating object.
SetWrappingStyle Set the wrapping type of this object (image, shape, chart).

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oGs1, oGs2, oFill, oStroke, oDrawing, oParagraph;
oParagraph = oDocument.GetElement(0);
oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 224, 204), 0);
oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(155, 64, 1), 100000);
oFill = Api.CreateRadialGradientFill([oGs1, oGs2]);
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oDrawing = Api.CreateShape("rect", 5930900, 395605, oFill, oStroke);
oDrawing.SetSize(2000 * 635, 2000 * 635);
oDrawing.SetWrappingStyle("inFront");
oDrawing.SetHorAlign("margin", "right");
oDrawing.SetVerAlign("page", "top");
oParagraph.AddDrawing(oDrawing);
builder.SaveFile("docx", "ApiDrawing.docx");
builder.CloseFile();

Resulting document