复制工作表
Contents
[
Hide
]
添加工作表描述了如何向Aspose.Cells.GridWeb添加新工作表。还可以将另一工作表的复制(或副本)添加到Aspose.Cells.GridWeb控件。当需要在另一个工作表中也需要相同或类似的数据时,复制现有工作表并将其添加到Aspose.Cells.GridWeb作为新工作表会更加方便,而不是从头开始创建。
复制工作表
使用Sheet索引
下面的示例代码显示了如何通过指定工作表在GridWorksheetCollection的AddCopy方法中的索引,将工作表的副本添加到GridWeb控件。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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控件。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
AddCopy方法返回新添加的工作表的索引,可以用于访问工作表实例。有关如何访问工作表的详细信息,请阅读访问工作表。