QuickStart: Excel for WPF > Step 2 of 4: Adding Content to a C1XLBook |
While you are still in code view in the Visual Studio project, add the following code to create the book and its content:
Visual Basic |
Copy Code
|
---|---|
Dim book As New C1XLBook() Dim i As Integer Dim sheet As XLSheet = book.Sheets(0) For i = 0 To 9 sheet(i, 0).Value = (i + 1) * 10 sheet(i, 1).Value = (i + 1) * 100 sheet(i, 2).Value = (i + 1) * 1000 Next End Function) End Sub |
C# |
Copy Code
|
---|---|
C1XLBook book = new C1XLBook(); int i; XLSheet sheet = book.Sheets[0]; for (i = 0; i <= 9; i++) { sheet[i, 0].Value = (i + 1) * 10; sheet[i, 1].Value = (i + 1) * 100; sheet[i, 2].Value = (i + 1) * 1000; } |