复制工作表

复制工作表

使用工作表索引

下面的示例代码显示了如何通过在 GridWorksheetCollection 的 AddCopy 方法中指定工作表的索引来将工作表的副本添加到 GridWeb 控件。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Adding the copy of a worksheet to GridWeb by specifying its sheet index
int sheetIndex = GridWeb1.WorkSheets.AddCopy(0);

使用工作表名称

下面的示例代码显示了如何通过在 GridWorksheetCollection 的 AddCopy 方法中指定工作表的名称来将工作表的副本添加到 GridWeb 控件。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Adding the copy of a worksheet to GridWeb by specifying its sheet name
int sheetIndex1 = GridWeb1.WorkSheets.AddCopy("Students");