Copy
创建指定形状的副本。
备注
此功能仅在 ONLYOFFICE Docs 付费版本中可用。
语法
expression.Copy();
expression - 表示 ApiShape 类的变量。
参数
此方法没有任何参数。
返回值
示例
复制形状并将副本放在 PDF 的另一页上。
// How do I make a copy of a shape in a PDF?
// Create an exact duplicate of a shape and add it to a new page in a PDF.
const doc = Api.GetDocument();
const page = doc.GetPage(0);
const fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("flowChartMagneticTape", 150 * 36000, 65 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
page.AddObject(shape);
const copyShape = shape.Copy();
const newPage = doc.AddPage(1);
newPage.AddObject(copyShape);