跳到主要内容

AddWordArt

使用指定的参数向当前工作表添加艺术字对象。

语法

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

expression - 表示 ApiWorksheet 类的变量。

参数

名称必需/可选数据类型默认值描述
oTextPr可选ApiTextPrApi.CreateTextPr()文本属性。
sText可选string"Your text here"艺术字对象的文本。
sTransform可选TextTransform"textNoShape"文本变换类型。
oFill可选ApiFillApi.CreateNoFill()用于填充艺术字对象的颜色或图案。
oStroke可选ApiStrokeApi.CreateStroke(0, Api.CreateNoFill())用于创建艺术字对象阴影的笔触。
nRotAngle可选number0旋转角度。
nWidth可选EMU1828800以英制度量单位度量的艺术字宽度。
nHeight可选EMU1828800以英制度量单位度量的艺术字高度。
nFromCol可选number0艺术字对象起始位置所在的列号。
nFromRow可选number0艺术字对象起始位置所在的行号。
nColOffset可选EMU0从 nFromCol 列到艺术字对象左侧的偏移量,以英制单位测量。
nRowOffset可选EMU0从 nFromRow 行到艺术字对象上部的偏移量,以英制单位测量。

返回值

ApiDrawing

示例

此示例使用指定的参数向工作表添加艺术字对象。

// How to add a word art to the worksheet specifying its properties, color, size, etc.

// Insert a word art to 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);