Introduction
In one of our previous topics, we discussed about adding new worksheets to Aspose.Grid.Web. But, what if a developer needs to add the copy (or replica) of another worksheet to Aspose.Grid.Web control. This feature can be useful for developers in those cases when same or similar data contained by one worksheet is also required in another worksheet. In that case, it would be more flexible for a developer to copy an existing worksheet and then add that copied worksheet to Aspose.Grid.Web as a new worksheet instead of creating the similar worksheet again from scratch.
Copying a Worksheet
Using Sheet index
Developers can add the copy of any existing worksheet to GridWeb control by specifying the Sheet Index (of the worksheet to be copied) to AddCopy method of WebWorksheets collection of GridWeb control as demonstrated below in the example.
Example:
[C#]
//Adding the copy of a worksheet to GridWeb by specifying its sheet index
int sheetIndex = GridWeb1.WebWorksheets.AddCopy(0);
[VB.NET]
'Adding the copy of a worksheet to GridWeb by specifying its sheet index
Dim sheetIndex As Integer = GridWeb1.WebWorksheets.AddCopy(0)
Using Sheet Name
Developers can also add the copy of any existing worksheet to GridWeb control by specifying the Sheet Name (of the worksheet to be copied) to AddCopy method of WebWorksheets collection of GridWeb control as demonstrated below in the example.
Example:
[C#]
//Adding the copy of a worksheet to GridWeb by specifying its sheet name
int sheetIndex = GridWeb1.WebWorksheets.AddCopy("Invoice");
[VB.NET]
'Adding the copy of a worksheet to GridWeb by specifying its sheet name
Dim sheetIndex As Integer = GridWeb1.WebWorksheets.AddCopy("Invoice")
NOTE: AddCopy method returns the Index of the newly added worksheet, which can be used to access the instance of this worksheet. For more details about accessing worksheets, please Click Here.
Describes how to access worksheets using the API of Aspose.Grid.Web.
8/16/2006 6:26:44 AM - -210.56.19.13