跳到主要内容

GetDocContent

返回可以插入段落或文本块的形状内部内容。

语法

expression.GetDocContent();

expression - 表示 ApiShape 类的变量。

参数

此方法没有任何参数。

返回值

ApiDocumentContent

示例

此示例展示如何获取可以插入段落或文本块的形状内部内容。

// How to get the doc content of the drawing.

// Retrieve the content of the shape add the paragraph to it.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
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);
let docContent = drawing.GetDocContent();
let classType = drawing.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Class Type = " + classType);
docContent.AddElement(0, paragraph);