跳到主要内容

InsertInContentControl

用富文本内容控件包装图形对象。

语法

expression.InsertInContentControl(nType);

expression - 表示 ApiDrawing 类的变量。

参数

名称必需/可选数据类型默认值描述
nType必需number定义此方法是返回 ApiBlockLvlSdt(nType === 1)还是 ApiDrawing(除 1 以外的任何值)对象。

返回值

ApiDrawing | ApiBlockLvlSdt

示例

此示例用富文本内容控件包装图形对象。

// How to add the drawing to the paragraph.

// Create a rectangle and then insert it to the another content control.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This graphic object was wrapped in content control");
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let drawing = Api.CreateShape("rect", 3212465, 963295, fill, stroke);
paragraph.AddDrawing(drawing);
drawing.InsertInContentControl(1);