Excel Library for C# and VB.NET applications

GemBox.Spreadsheet is a C# / VB.NET library which provides an easy and high performance way to process Excel files. It enables developers to read, write, convert and print spreadsheet files (XLSX, XLS, CSV, ODS, HTML, PDF, XPS) from .NET applications without the need for Microsoft Excel on either the developer or client machines.

GemBox.Spreadsheet for .NET 2.0 requires .NET Framework version 2.0 and GemBox.Spreadsheet for .NET 3.0 - 4.6 requires .NET Framework version 3.0 or above.

Notice that on the right side you have GemBox.Spreadsheet Examples section with which you can navigate through examples and explore supported features.

Also below the example description you have Run options where you can choose output file format and execute the example using GemBox.Spreadsheet in Professional mode. GemBox.Spreadsheet also offers Free and Trial modes, see Evaluation and Licensing.

Hello World

Following sample creates a simple HelloWorld Excel file in C# and VB.NET code. It shows how to initialize GemBox.Spreadsheet content model, populate some cells, and then save ExcelFile to an Excel file in the desired format. It also demonstrates support for International characters (Unicode support).


Excel Library for C# / VB.NET Screenshot

See the full code below, use RUN EXAMPLE to execute.

1using GemBox.Spreadsheet;
3class Sample
5    [STAThread]
6    static void Main(string[] args)
7    {
8        // If using Professional version, put your serial key below.
9        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");
11        ExcelFile ef = new ExcelFile();
12        ExcelWorksheet ws = ef.Worksheets.Add("Hello World");
14        ws.Cells[0, 0].Value = "English:";
15        ws.Cells[0, 1].Value = "Hello";
17        ws.Cells[1, 0].Value = "Russian:";
18        // Using UNICODE string.
19        ws.Cells[1, 1].Value = new string(new char[] { '\u0417', '\u0434', '\u0440', '\u0430', '\u0432', '\u0441', '\u0442', '\u0432', '\u0443', '\u0439', '\u0442', '\u0435' });
21        ws.Cells[2, 0].Value = "Chinese:";
22        // Using UNICODE string.
23        ws.Cells[2, 1].Value = new string(new char[] { '\u4f60', '\u597d' });
25        ws.Cells[4, 0].Value = "In order to see Russian and Chinese characters you need to have appropriate fonts on your PC.";
26        ws.Cells.GetSubrangeAbsolute(4, 0, 4, 7).Merged = true;
28        ef.Save("Hello World.xls");
29    }
1Imports GemBox.Spreadsheet
3Module Samples
5    Sub Main()
7        ' If using Professional version, put your serial key below.
8        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")
10        Dim ef As ExcelFile = New ExcelFile
11        Dim ws As ExcelWorksheet = ef.Worksheets.Add("Hello World")
13        ws.Cells(0, 0).Value = "English:"
14        ws.Cells(0, 1).Value = "Hello"
16        ws.Cells(1, 0).Value = "Russian:"
17        ' Using UNICODE string.
18        ws.Cells(1, 1).Value = New String(New Char() {ChrW(&H417), ChrW(&H434), ChrW(&H440), ChrW(&H430), ChrW(&H432), ChrW(&H441), ChrW(&H442), ChrW(&H432), ChrW(&H443), ChrW(&H439), ChrW(&H442), ChrW(&H435)})
20        ws.Cells(2, 0).Value = "Chinese:"
21        ' Using UNICODE string.
22        ws.Cells(2, 1).Value = New String(New Char() {ChrW(&H4F60), ChrW(&H597D)})
24        ws.Cells(4, 0).Value = "In order to see Russian and Chinese characters you need to have appropriate fonts on your PC."
25        ws.Cells.GetSubrangeAbsolute(4, 0, 4, 7).Merged = True
27        ef.Save("Hello World.xls")
29    End Sub
31End Module

Check next sample or find out more about GemBox.Spreadsheet and GemBox Software.