跳到主要内容

Copy

Creates a copy of the current table.

Syntax

expression.Copy();

expression - A variable that represents a ApiTable class.

Parameters

This method doesn't have any parameters.

Returns

ApiTable

Example

This example creates a copy of the table.

// How to copy a table and add it to the slide.

// Create a 2x4 table, its copy and add them to the presentation.

const presentation = Api.GetPresentation();

const table = Api.CreateTable(2, 4);
table.AddRow(1, true);
const row = table.GetRow(1);
const cell = row.GetCell(0);
const content = cell.GetContent();
const paragraph = Api.CreateParagraph();
paragraph.AddText("New row was added here.");
content.Push(paragraph);

const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
slide.AddObject(table);

const copyTable = table.Copy();
const newSlide = Api.CreateSlide();
presentation.AddSlide(newSlide);
newSlide.AddObject(copyTable);