# Quick Start

This topic describes how to install NuGet packages which contain APIs for Spread for WPF.

## Content

This quick start guide will help you create a simple WPF application, install NuGet packages, and add Spread WPF controls to your Visual Studio project. You can get started with Spread for WPF with NuGet packages in .NET Framework and .NET Core editions by following the steps mentioned in the section below.

## .NET Framework

To create a simple WPF application (.NET Framework) in Visual Studio, complete the following steps:

1. Open **Microsoft Visual Studio** and click **Create a new project.**
2. In the **Create a new project** dialog, choose **WPF App (.NET Framework)**, and click **Next**.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.985739.png)
3. In the **Configure your new project** dialog, enter the name and location for your project and click **Create**.
    This is an optional step as you can use the default project name and location if you want.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.cf6932.png)
4. Open the **Solution Explorer** panel, right-click on the project and select **Manage NuGet Packages** to add the .NET references to the project.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.4dd1ed.png)
5. In the **NuGet Package Manager** dialog, select **nuget.org** as the **Package source**.
6. Browse and install the **Mescius.Spread.Wpf** NuGet package into your solution.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.5b2d4e.png)
    Once installed, all the available assembly files will be added under **References.**
7. **Right-click on Properties** and select **Add** \> **New Item...**
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.65ed26.png)
8. From the **Add new item** dialog, add a text file and name it as **Licenses.licx**.
9. Add the license string for Spread as follows:

    ```auto
    GrapeCity.Wpf.SpreadSheet.GcSpreadSheet, GrapeCity.Wpf.SpreadSheet
    ```
10. Open the XAML view, i.e. **MainWindow.xaml** file.
    Add the following code to declare the XML namespace for integrating the spreadsheet component into a XAML application. The URL provided in the namespace declaration refers to an XML schema that defines the controls of the spreadsheet component.

    ```xml
    xmlns:gss="http://schemas.grapecity.com/windows/spreadsheet/2020"
    ```

    Create Window\_Loaded event and assign names to the GcSpreadSheet and GcFormulaBar controls in the XAML code.
    The XAML markup should look like the following:

    ```xml
    <Window x:Class="YourApplicationName.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:gss="http://schemas.grapecity.com/windows/spreadsheet/2020"
            mc:Ignorable="d"
            Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
    <Grid>
        <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition/>
                <RowDefinition Height="350"/>
                <RowDefinition/>
        </Grid.RowDefinitions>
        <gss:GcFormulaBar x:Name="formulaBar1" Grid.Row="0" ShowEditingButtons="True" Expandable="True"  AssociatedSpread="{x:Reference Name=spreadSheet1}"/>
        <gss:GcSpreadSheet x:Name="spreadSheet1" Grid.Row="1" Margin="0,0,0,149" Grid.RowSpan="2"  />
    </Grid>
    </Window>
    ```
11. Switch to the code view. (**MainWindow.xaml.cs** for C# or **MainWindow.xaml.vb** for Visual Basic)
    Under the **Window\_Loaded** event handler, add the following example codes to start the basic operations with the controls.

    ```csharp
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        // Create an instance of GcSpreadSheet workbook.
        GrapeCity.Spreadsheet.IWorkbook workbook = spreadSheet1.Workbook;
        // Get the default worksheet.
        GrapeCity.Spreadsheet.IWorksheet worksheet = spreadSheet1.Workbook.ActiveSheet;
        // Add data to the cells.
        worksheet.Cells[0, 0].Value = "Welcome to Spread for WPF";    
        // Save the workbook.
        workbook.SaveAs("SavedWorkbook.xlsx", GrapeCity.Spreadsheet.IO.FileFormat.OpenXMLWorkbook);
    }
    ```

    ```auto
    Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
        ' Create an instance of GcSpreadSheet workbook.
        Dim workbook As GrapeCity.Spreadsheet.IWorkbook = spreadSheet1.Workbook
        ' Get the default worksheet.
        Dim worksheet As GrapeCity.Spreadsheet.IWorksheet = spreadSheet1.Workbook.ActiveSheet
        ' Add data to the cells.
        worksheet.Cells[0, 0].Value = "Welcome to Spread for WPF"
        ' Save the workbook.
        workbook.SaveAs("SavedWorkbook.xlsx", GrapeCity.Spreadsheet.IO.FileFormat.OpenXMLWorkbook)
    End Sub
    ```
12. Build the project and run to view the controls in your application.

## .NET Core

To create a simple WPF application (.NET Core) in Visual Studio, complete the following steps:

1. Open **Microsoft Visual Studio and** click **Create a new project.**
2. In the **Create a new project** dialog, select **WPF Application**, and then click **Next**.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.5e7e0a.png)
3. In the **Configure your new project** dialog, enter the name and location for your project and click **Next**.
    This is an optional step as you can use the default project name and location if you want.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.be1861.png)
4. In the **Additional information** dialog, select the framework version from the dropdown and click **Create**.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.c555c6.png)
5. Open the **Solution Explorer** panel, right-click on **Dependencies** and select **Manage NuGet Packages..** to add the .NET references to the project.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.338478.png)
6. In the **NuGet Package Manager**, select **nuget.org** as the **Package source**.
7. Search for **Mescius.Spread.Wpf** and click **Install** to install the NuGet package into your solution.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.b7314c.png)
8. Once installed, the package will be added under **Packages**.
    ![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.0ea8ba.png)
9. Open the XAML view, i.e. **MainWindow.xaml** file.
    Add the following code to declare the XML namespace for integrating the spreadsheet component into a XAML application. The URL provided in the namespace declaration refers to an XML schema that defines the controls of the spreadsheet component.

    ```xml
    xmlns:gss="http://schemas.grapecity.com/windows/spreadsheet/2020"
    ```

    Create **Window\_Loaded** event and assign names to the **GcSpreadSheet** and **GcFormulaBar** controls in the XAML code.
    The XAML markup should look like the following:

    ```xml
    <Window
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:gss="http://schemas.grapecity.com/windows/spreadsheet/2020"
            x:Class="YourApplicationName.MainWindow"
            mc:Ignorable="d"
            Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded" >
        <Grid>
           <Grid.RowDefinitions>
                 <RowDefinition Height="30"/>
                 <RowDefinition/>
                 <RowDefinition Height="350"/>
                 <RowDefinition/>
           </Grid.RowDefinitions>
         <gss:GcFormulaBar x:Name="formulaBar1" Grid.Row="0" ShowEditingButtons="True" Expandable="True"  AssociatedSpread="{x:Reference Name=spreadSheet1}"/>
         <gss:GcSpreadSheet x:Name="spreadSheet1" Grid.Row="1" Margin="0,0,0,149" Grid.RowSpan="2"  />
        </Grid>
    </Window>
    ```
10. Switch to the code view. (**MainWindow.xaml.cs** for C# or **MainWindow.xaml.vb** for Visual Basic)
    Under the **Window\_Loaded** event handler, add the following example codes to start the basic operations with the controls.

    ```csharp
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        // Create an instance of GcSpreadSheet workbook.
        GrapeCity.Spreadsheet.IWorkbook workbook = spreadSheet1.Workbook;
        // Get the default worksheet.
        GrapeCity.Spreadsheet.IWorksheet worksheet = spreadSheet1.Workbook.ActiveSheet;
        // Add data to the cells.
        worksheet.Cells[0, 0].Value = "Welcome to Spread for WPF";    
        // Save the workbook.
        workbook.SaveAs("SavedWorkbook.xlsx", GrapeCity.Spreadsheet.IO.FileFormat.OpenXMLWorkbook);
    }
    ```

    ```auto
    Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
        ' Create an instance of GcSpreadSheet workbook.
        Dim workbook As GrapeCity.Spreadsheet.IWorkbook = spreadSheet1.Workbook
        ' Get the default worksheet.
        Dim worksheet As GrapeCity.Spreadsheet.IWorksheet = spreadSheet1.Workbook.ActiveSheet
        ' Add data to the cells.
        worksheet.Cells[0, 0].Value = "Welcome to Spread for WPF"
        ' Save the workbook.
        workbook.SaveAs("SavedWorkbook.xlsx", GrapeCity.Spreadsheet.IO.FileFormat.OpenXMLWorkbook)
    End Sub
    ```
11. Build the project and run to view GcSpreadSheet and GcFormulaBar controls in your application.

The output will look like as below.
![image](https://cdn.mescius.io/document-site-files/images/0f63724f-fddf-4351-8c24-0b4338c0fda9/image.f637c1.png)

> type=note
> **Note**: You can also install Spread for WPF using the Spread Studio package from the [official website](https://developer.mescius.com/) and then create a WPF application. For more information, refer to [Add Components to Toolbox](/spreadnet/docs/latest/online-wpf/quickstart/quickstartbyusingsdlls).