Spread Windows Forms 15.0
Spread Windows Forms 15.0 Product Documentation / Developer's Guide / Working with the Component / Adding NuGet Package in Spread Windows Forms
In This Topic
    Adding NuGet Package in Spread Windows Forms
    In This Topic

    The following section explains how to use Spread Windows Forms in a .NET Framework and .NET 5/.NET 6 (or .NET Core 3.1) platform by using GrapeCity.Spread.WinForms NuGet package.

     

    Follow the below steps to create a Windows Forms application in .NET Framework platform:

    1. Click on 'Create a new project' and select 'Windows Forms App (.NET Framework)'.
      Create a new project dialog
    2. Name the project and click Create.
    3. Right click on References and click 'Manage NuGet Packages'.
      Context menu for References
    4. Search 'Grapecity.Spread' and install GrapeCity.Spread.WinForms NuGet package in your solution.
      Nuget Package Manager Dialog
    5. Right click Properties and add a new item.
      Context menu for Properties
    6. Add a text file from 'Add new item' dialog and name it as licenses.licx.
      Add new item dialog
    7. Add Spread's license string as follows:
      FarPoint.Win.Spread.FpSpread, FarPoint.Win.Spread
      

    8. Double click on Form1.cs and add the fpSpread control using the following code in its form load event.
      Form1.cs
      Copy Code
      FpSpread fpSpread1 = new FpSpread();
      fpSpread1.Location = new System.Drawing.Point(52, 12);
      fpSpread1.Name = "fpSpread1";
      fpSpread1.Size = new System.Drawing.Size(653, 380);
      fpSpread1.Sheets.Count = 2;
      this.Controls.Add(fpSpread1);
      fpSpread1.ActiveSheet.Cells[0, 0].Text = "Welcome";
      

    9. Build the project and run to view fpSpread control on to the Form.

    Please note that the WinForms .NET 5/.NET 6 Edition does not provide complete design-time support. Hence, you might not be able to drag drop spread control from toolbox.

    The below steps use Visual Studio 2019 v16.9+ to create a Windows Forms application as it supports .NET 5/.NET 6/.NET Core 3.1 platforms:

    1. Click on 'Create a new project' and select 'Windows Forms App (.NET)'.
      Create a new project dialog
    2. Name the project and click Create.

    3. Right click on References and click 'Manage NuGet Packages'.

    4. Search 'Grapecity.Spread' and install GrapeCity.Spread.WinForms NuGet package in your solution.
      Nuget Package Manager Dialog
    5. Double click on Form1.cs and add the fpSpread control using the following code in its form load event.
      Form1.cs
      Copy Code
      FpSpread fpSpread1 = new FpSpread();
      fpSpread1.Location = new System.Drawing.Point(52, 12);
      fpSpread1.Name = "fpSpread1";
      fpSpread1.Size = new System.Drawing.Size(653, 380);
      fpSpread1.Sheets.Count = 2;
      this.Controls.Add(fpSpread1);
      fpSpread1.ActiveSheet.Cells[0, 0].Text = "Welcome";
      

    6. Build the project and run to view fpSpread control on to the Form.
    Licenses.licx file with FpSpread license string isn't required in .Net 5/.NET 6 application.