Push
推送段落或表格以将其实际添加到文档中。
语法
expression.Push(oElement);
expression - 表示 ApiDocumentContent 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| oElement | 必需 | DocumentElement | 将推送到文档的元素类型。 |
返回值
boolean
示例
此示例推送 5 个段落以将其实际添加到文档内容中。
// How to insert paragraphs into a document.
// Add text to a newly created paragraph and add this paragraph into document.
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);