访问工作表
Contents
[
Hide
]
这个主题讨论了如何访问Aspose.Cells.GridWeb控件中的工作表。我们将它们称为“web工作表”,因为它们属于Aspose.Cells.GridWeb并在Web应用程序中使用。
访问工作表
Aspose.Cells.GridWeb中包含的所有工作表都存储在GridWeb控件的GridWorksheetCollection中。有两种方法可以访问工作表:通过工作表索引或工作表名称。
使用工作表索引
下面的代码片段显示了如何通过工作表索引从GridWeb控件的GridWorksheetCollection中访问特定的web工作表。
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 | |
// Accessing a worksheet using its index | |
GridWorksheet sheet = GridWeb1.WorkSheets[0]; | |
Label1.Text = "Sheet at index 0 is : " + sheet.Name + "<br/>"; |
使用工作表名称
下面的代码片段显示了如何通过工作表名称从GridWeb控件的GridWorksheetCollection集合中访问web工作表。
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 | |
// Accessing a worksheet using its name | |
GridWorksheet sheet1 = GridWeb1.WorkSheets["Catalog"]; | |
Label1.Text += "Index of sheet Catalog is : " + sheet1.Index + "<br/>"; |