Syncfusion AI Assistant

How can I help you?

Getting Started with Windows Forms Spreadsheet

27 May 20265 minutes to read

This section briefly explains how to include the Syncfusion® WinForms Spreadsheet component in Windows Forms App using Visual Studio.

Prerequisites

Create a new Windows Forms App in Visual Studio

You can create a Windows Forms Application using Visual Studio via Microsoft Templates or the Syncfusion® Windows Forms.

Assemblies Deployment

To add a WinForms spreadsheet component to your application by installing it via NuGet packages(Recommended) or by manually adding the required assemblies to the project.

Install Syncfusion® Windows Forms Spreadsheet NuGet packages

To add Windows Forms Spreadsheet component in the application, open the NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), search and install:

Syncfusion.Spreadsheet.Windows

Add Syncfusion® WinForms Spreadsheet Assemblies

Below table describes, list of assemblies required to be added in project when the WinForms Spreadsheet control is used in your application.

Assembly Description
Syncfusion.Spreadsheet.Windows.dll Contains the classes that handles all the UI Operations of Spreadsheet such as importing of sheets, applying formulas/styles etc.
Syncfusion.Shared.Base.dll Contains the classes which holds the controls like TabBarPage, TabBarSplitterControl etc.
Syncfusion.Tools.Windows.dll Contains the classes which holds the controls like Ribbon, ToolStripPanelItem,MaskedEditBox,ToolStripGallery,BackStageButton etc which are used in Spreadsheet.
Syncfusion.XlsIO.Base.dll Contains the base classes which is responsible for read and write in Excel files, Worksheet Manipulations, Formula calculations etc.

Below are the assemblies list that can be added when you want to enable certain features in Spreadsheet control.

Optional Assemblies Description
Syncfusion.SpreadsheetHelper.Windows.dll Contains the classes which is responsible for importing charts and sparklines into Spreadsheet
Syncfusion.ExcelChartToImageConverter.WPF.dll Contains the classes which is responsible for converting charts as image
Syncfusion.Chart.Base.dll Contains the base classes which is responsible for importing charts like Line charts, Pie charts, Sparklines etc.
Syncfusion.Chart.Windows.dll Contains the classes which is responsible for creating charts that holds axes, series, legends etc.
Syncfusion.ExcelToPDFConverter.Base.dll Contains the base and fundamental classes which is responsible for converting excel to PDF.
Syncfusion.Pdf.Base.dll Contains the base and fundamental classes for creating PDF.

Add Windows Forms Spreadsheet component

WinForms Spreadsheet control can be added to an application either through the designer (XAML) or programmatically using code.

  1. Open the Visual Studio Tool box. Navigate to Syncfusion® Controls tab and find the Spreadsheet/SpreadsheetRibbon toolbox items.

Toolbox in WindowsForms Spreadsheet

  1. Drag Spreadsheet and drop in the Designer area from the Toolbox.
....
partial class Form1
{
....
private void InitializeComponent()
{
Spreadsheet spreadsheet = new Spreadsheet();
}
....
}
....
  1. Ribbon can be added to the application by dragging SpreadsheetRibbon to the Designer area.
....
partial class Form1
{
....
private void InitializeComponent()
{
Spreadsheet spreadsheet = new Spreadsheet();
SpreadsheetRibbon spreadsheetRibbon = new SpreadsheetRibbon();
}
....
}
....
  1. To make an interaction between Ribbon items and Spreadsheet, bind the Spreadsheet as DataContext to the SpreadsheetRibbon.
....
partial class Form1
{
....
private void InitializeComponent()
{
Spreadsheet spreadsheet = new Spreadsheet();
SpreadsheetRibbon spreadsheetRibbon = new SpreadsheetRibbon();
spreadsheetRibbon.Spreadsheet = spreadsheet;
}
....
}
....

Spreadsheet is available in the following namespace Syncfusion.Windows.Forms.Spreadsheet and it can be created programmatically by using below code.

For Spreadsheet

....
    public Form1()
    {
        InitializeComponent();
        Spreadsheet spreadsheet = new Spreadsheet();
        SpreadsheetRibbon ribbon = new SpreadsheetRibbon() { Spreadsheet = spreadsheet };
        spreadsheet.Dock = DockStyle.Fill;
        spreadsheet.Anchor = AnchorStyles.Left | AnchorStyles.Top;
        this.Controls.Add(spreadsheet);
        this.Controls.Add(ribbon);
    }
....

Run the application

Press Ctrl+F5 (Windows) or +F5 (macOS) to launch the application.The output will appear as follows:

Adding control via coding in WindowsForms Spreadsheet

To learn how to create, open, and save files in the WPF Spreadsheet Component, see Workbook Operations.

NOTE

View Sample in GitHub.

See Also