# Quick Start

## Content



This quick start guides you through the steps of creating a simple List application. You begin by creating a Windows Forms App in Visual Studio, creating a C1XLBook , adding content to it, formatting the data, and then saving it to an XLS file.

![](https://cdn.mescius.io/document-site-files/images/2f1197a8-415d-4bfe-b1e0-0a66c2dd3972/images/quick_start.png)

Follow the given steps to create a simple Excel application.

## Set Up the Application

1.  Create a new **Windows Forms App** and set the project framework to **.NET 8.0** using Configure your new project window.
2.  Add reference to the Excel assembly in your application by installing **C1.Excel** NuGet package from **NuGet Package Manager**.
3.  Switch to the code view and create a new instance of the C1XLBook class using the following code.
    
    ```csharp
    c1XLBook1 = new C1XLBook();
    ```
    

## Add Content to C1XLBook

To add content to C1XLBook, you need to first add a sheet to it using the [XLSheet](/componentone/docs/win/online-excel/) class. Once you add the sheet, you can easily add content to its cells by using [Value](/componentone/docs/win/online-excel/) property of the [XLCell](/componentone/docs/win/online-excel/) class as demonstrated in the following code snippet. In this example, we populate the first ten rows in the first three columns of the sheet named First\_Sheet with random numbers.

```csharp
// Add content to the sheet.
int i;
C1.C1Excel.XLSheet sheet = c1XLBook1.Sheets[0];
sheet.Name = "First_Sheet";
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;
}
```

## Style the Content

To style the content of XLSheet, you can use the [XLStyle](/componentone/docs/win/online-excel/) class as demonstrated in the following steps:

1.  Create a custom style as an object of XLStyle class and define its properties such as background color, foreground color, and font style. In this example, we create two styles and set their respective properties such as font, foreground color, and background color.
    
    ```csharp
    // Add style 1.
    XLStyle style1 = new XLStyle(c1XLBook1);
    style1.Font = new Font("Tahoma", 9, FontStyle.Bold);
    style1.ForeColor = Color.RoyalBlue;
    // Add style 2.
    XLStyle style2 = new XLStyle(c1XLBook1);
    style2.Font = new Font("Tahoma", 9, FontStyle.Italic);
    style2.BackColor = Color.RoyalBlue;
    style2.ForeColor = Color.White;
    ```
    
2.  Apply the created styles to rows and columns of the sheet using Style property of the XLCell class as demonstrated in the following code.
    
    ```csharp
    for (i = 0; i <= 9; i++)
    {
        // Apply styles to the content.
        if ((i + 1) % 2 == 0)
        {
            sheet[i, 0].Style = style2;
            sheet[i, 1].Style = style1;
            sheet[i, 2].Style = style2;
        }
        else
        {
            sheet[i, 0].Style = style1;
            sheet[i, 1].Style = style2;
            sheet[i, 2].Style = style1;
        }
    }
    ```
    

## Save the File

Now, you can save the updates to an XLS file using [Save](/componentone/docs/win/online-excel/) method of the **C1XLBook** class as demonstrated in the following code. In this example, we save the content to "mybook.xls" file in the bin directory of the project folder.

```csharp
c1XLBook1.Save("mybook.xls");
System.Diagnostics.Process.Start("mybook.xls");
```