[]
In the last step, you created a WPF application and added the C1FlexSheet control to it. In this step, you add a sheet to the control and populate it with ordered data to see how the control works.
Add a new sheet to FlexSheet control by adding the following code beneath InitializeComponent() method in the interaction logic for XAML:
vbnet
flex.AddSheet("Sheet1", 50, 10)
csharp
flex.AddSheet("Sheet1", 50, 10);
Populate the sheet with data by adding the following code:
vbnet
' populate the grid with some formulas (multiplication table)
For r As Integer = 0 To flex.Rows.Count - 3
Dim datas As New List(Of Double)()
For c As Integer = 0 To flex.Columns.Count - 1
flex(r, c) = String.Format("={0}*{1}", r + 1, c + 1)
Dim value As Double = CDbl(flex(r, c))
datas.Add(value)
Next
csharp
// populate the grid with some formulas (multiplication table)
for (int r = 0; r < flex.Rows.Count - 2; r++)
{
List<double> datas = new List<double>();
for (int c = 0; c < flex.Columns.Count; c++)
{
flex[r, c] = string.Format("={0}*{1}", r + 1, c + 1);
double value = (double)flex[r, c];
datas.Add(value);
}
}
With this, you have successfully added a sheet to your FlexSheet control and populated it with data.