Once you bind a sheet to a data set you might want to add an unbound row to contain additional data.
The following figure shows a sheet in a Spread component that contains data from a data set and an unbound row at the bottom that calculates the averages.
Return to the overall list of tasks in Adding to Bound Data.
Using a Shortcut
- Create your data set.
- Set the FpSpread or Sheet DataSource property equal to the data set.
- Call the Sheet AddUnboundRows method to specify where to add the unbound row.
- Set properties for the unbound row.
Example
This example code binds the Spread component to a data set then adds an unbound row.
C# | Copy Code |
---|---|
// Bind the component to the data set. fpSpread1.DataSource = dbDataSet; // Add an unbound row. fpSpread1.Sheets[0].AddUnboundRows(20, 1); |
VB | Copy Code |
---|---|
' Bind the component to the data set. FpSpread1.DataSource = dbDataSet ' Add an unbound row. FpSpread1.Sheets(0).AddUnboundRows(20, 1) |
Using Code
- Create your data set.
- Create a new SheetView object.
- Set the SheetView object DataSource property equal to the data set.
- Call the SheetView object AddUnboundRows method to specify where to add the unbound row.
- Set properties for the unbound row.
- Assign the SheetView object to a sheet in the component.
Example
This example code creates a bound SheetView object and adds an unbound row to it, then assigns it to a sheet in a Spread component.
C# | Copy Code |
---|---|
// Create a new SheetView object. FarPoint.Win.Spread.SheetView newsheet = new FarPoint.Win.Spread.SheetView(); // Bind the SheetView object to the data set. newsheet.DataSource = dataSet1; // Add an unbound row. newsheet.AddUnboundRows(20, 1); // Assign the SheetView object to the first sheet. fpSpread1.Sheets[0] = newsheet; |
VB | Copy Code |
---|---|
' Create a new SheetView object. Dim newsheet As New FarPoint.Win.Spread.SheetView() ' Bind the SheetView object to the data set. newsheet.DataSource = DataSet1 ' Add an unbound row. newsheet.AddUnboundRows(20, 1) ' Assign the SheetView object to the first sheet. FpSpread1.Sheets(0) = newsheet |