GetContent
返回可以插入段落或文本运行的形状内部内容。
语法
expression.GetContent();
expression - 表示 ApiShape 类的变量。
参数
此方法没有任何参数。
返回值
示例
此示例展示如何获取可以插入段落或文本运行的形状内部内容。
// How to get content of ApiShape.
// Get content of ApiShape, remove all its elements and add a new paragraph to it.
let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = worksheet.AddShape("flowChartOnlineStorage", 60 * 36000, 35 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
let content = shape.GetContent();
content.RemoveAllElements();
let paragraph = Api.CreateParagraph();
paragraph.SetJc("left");
paragraph.AddText("We removed all elements from the shape and added a new paragraph inside it.");
content.Push(paragraph);