Get Started
Usage API
More information

ApiDrawing

new ApiDrawing()

Class representing a graphical object.

Methods

Name Description
AddBreak

Insert a break at the specified location in the main document.

Copy

Copy the graphic object.

Delete

Delete the graphic object.

Fill

Set the fill formatting properties for the specified graphic object.

GetClassType

Get the type of the class based on this base class.

GetNextDrawing

Get the next inline drawing object.

GetParentContentControl

Get the parent content control that contains the graphic object.

GetParentParagraph

Get the parent paragraph that contains the graphic object.

GetParentTable

Get the parent table that contains the graphic object.

GetParentTableCell

Get the parent table cell that contains the graphic object.

GetPrevDrawing

Get the previous inline drawing object.

InsertInContentControl

Wrap the graphic object with a rich text content control.

InsertParagraph

Insert a paragraph at the specified position.

ScaleHeight

Scale the height of the figure using the specified coefficient.

ScaleWidth

Scale the width of the graphic object using the specified coefficient.

Select

Select the graphic object.

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.

SetHorFlip

Horizontal reflection.

SetHorPosition

Set an absolute measurement for the horizontal positioning of the floating object.

SetOutLine

Set the outline properties for the specified graphic 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.

SetVertFlip

Vertical reflection.

SetWrappingStyle

Set the wrapping type of this object (image, shape, chart). One of the following wrapping style types can be set:

  • "inline" - the object is considered to be a part of the text, like a character, so when the text moves, the object moves as well. In this case the positioning options are inaccessible. If one of the following styles is selected, the object can be moved independently of the text and positioned on the page exactly:
  • "square" - the text wraps the rectangular box that bounds the object.
  • "tight" - the text wraps the actual object edges.
  • "through" - the text wraps around the object edges and fills in the open white space within the object.
  • "topAndBottom" - the text is only above and below the object.
  • "behind" - the text overlaps the object.
  • "inFront" - the object overlaps the text.

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
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