You can copy and insert a sheet to the same Spread component or another Spread component on the form. Spread does not provide a way to copy the sheet, but with the code given below you can easily create your own CopySheet method.
This is the code for the CopySheet method.
C# |
Copy Code
|
---|---|
public FarPoint.Win.Spread.SheetView CopySheet(FarPoint.Win.Spread.SheetView sheet) { FarPoint.Win.Spread.SheetView newSheet = null; if (sheet != null ) { newSheet = FarPoint.Win.Serializer.LoadObjectXml(GetType(FarPoint.Win.Spread.SheetView), FarPoint.Win.Serializer.GetObjectXml(sheet, "CopySheet"), "CopySheet"); } return newSheet; } |
Visual Basic |
Copy Code
|
---|---|
Public Function CopySheet(sheet As FarPoint.Win.Spread.SheetView) As FarPoint.Win.Spread.SheetView Dim newSheet as FarPoint.Win.Spread.SheetView = Nothing If Not IsNothing(sheet) Then newSheet = FarPoint.Win.Serializer.LoadObjectXml(GetType(FarPoint.Win.Spread.SheetView), FarPoint.Win.Serializer.GetObjectXml(sheet, "CopySheet"), "CopySheet") End If Return newSheet End Function |
To insert a copied sheet into the control, use the Add or Insert method of the SheetViewCollection class referenced by the Sheets property of the FpSpread class after calling the CopySheet method.
The Spread Designer can be used to copy and paste a sheet at design time. Right-click on the sheet tab icon in the designer to bring up the Copy, Cut, and Paste context menu.