CreateWordArt

CreateWordArt([oTextPr], [sText], [sTransform], [oFill], [oStroke], [nRotAngle], [nWidth], [nHeight]) → { ApiDrawing }

Creates a Text Art object with the parameters specified.

Parameters:

Name Type Default Description
oTextPr ApiTextPr Api.CreateTextPr()

The text properties.

sText string "Your text here"

The text for the Text Art object.

sTransform TextTransform "textNoShape"

Text transform type.

oFill ApiFill Api.CreateNoFill()

The color or pattern used to fill the Text Art object.

oStroke ApiStroke Api.CreateStroke(0, Api.CreateNoFill())

The stroke used to create the Text Art object shadow.

nRotAngle number 0

Rotation angle.

nWidth EMU 1828800

The Text Art width measured in English measure units.

nHeight EMU 1828800

The Text Art heigth measured in English measure units.

Returns:

Type
ApiDrawing

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTextPr = Api.CreateTextPr();
oTextPr.SetFontSize(30);
oTextPr.SetBold(true);
oTextPr.SetCaps(true);
oTextPr.SetColor(51, 51, 51, false);
oTextPr.SetFontFamily("Comic Sans MS");
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(1 * 36000, Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51)));
var oTextArt = Api.CreateWordArt(oTextPr, "onlyoffice", "textArchUp", oFill, oStroke, 0, 150 * 36000, 50 * 36000);
var oParagraph = oDocument.GetElement(0);
oParagraph.AddDrawing(oTextArt);
builder.SaveFile("docx", "CreateWordArt.docx");
builder.CloseFile();

Resulting document