RemoveAllElements
从当前运行中移除所有元素。
语法
expression.RemoveAllElements();
expression - 表示 ApiRun 类的变量。
参数
此方法没有任何参数。
返回值
boolean
示例
此示例从运行中移除所有元素。
// How to remove all text elements.
// Create a text run object, add a text to it and clear its content.
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();
let paragraph = content.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text.");
run.RemoveAllElements();
run.AddText("All elements from this run were removed before adding this text.");
paragraph.AddElement(run);