Skip to main content

AddWordArt

Adds a Text Art object to the current sheet with the parameters specified.

Syntax

expression.AddWordArt(oTextPr, sText, sTransform, oFill, oStroke, nRotAngle, nWidth, nHeight, nFromCol, nFromRow, nColOffset, nRowOffset);

expression - A variable that represents a ApiWorksheet class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oTextPrOptionalApiTextPrApi.CreateTextPr()The text properties.
sTextOptionalstring"Your text here"The text for the Text Art object.
sTransformOptionalTextTransform"textNoShape"Text transform type.
oFillOptionalApiFillApi.CreateNoFill()The color or pattern used to fill the Text Art object.
oStrokeOptionalApiStrokeApi.CreateStroke(0, Api.CreateNoFill())The stroke used to create the Text Art object shadow.
nRotAngleOptionalnumber0Rotation angle.
nWidthOptionalEMU1828800The Text Art width measured in English measure units.
nHeightOptionalEMU1828800The Text Art heigth measured in English measure units.
nFromColOptionalnumber0The column number where the beginning of the Text Art object will be placed.
nFromRowOptionalnumber0The row number where the beginning of the Text Art object will be placed.
nColOffsetOptionalEMU0The offset from the nFromCol column to the left part of the Text Art object measured in English measure units.
nRowOffsetOptionalEMU0The offset from the nFromRow row to the upper part of the Text Art object measured in English measure units.

Returns

ApiDrawing

Example

Place a styled decorative text object onto a sheet in a spreadsheet.

// How do I add eye-catching artistic text with custom fonts and colors in a spreadsheet?

// Render a bold curved text banner with a solid fill and outline on the worksheet.

let worksheet = Api.GetActiveSheet();
let textProps = Api.CreateTextPr();
textProps.SetFontSize(72);
textProps.SetBold(true);
textProps.SetCaps(true);
textProps.SetColor(Api.HexColor('#333333'));
textProps.SetFontFamily("Comic Sans MS");
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(1 * 36000, Api.CreateSolidFill(Api.RGB(51, 51, 51)));
worksheet.AddWordArt(textProps, "onlyoffice", "textArchUp", fill, stroke, 0, 100 * 36000, 20 * 36000, 0, 2, 2 * 36000, 3 * 36000);