Open Source .NET Library for Handling Excel Spreadsheets
Free .NET Library that enables software developers to Read, Write & Manipulate Excel XLSX Spreadsheets with ease.
Simplexcel is an Open source .NET library that provides functionality for working with Excel XLSX spreadsheet via .NET. The library mainly focuses on the most common features and tasks that can help the developer to create a spreadsheet. The library has provided complete support for ASP.NET and Windows Services.
The open source Simplexcel library gives software to generate Excel 2007+ workbooks in their native XLSX format without relying on COM interop. The library has included support for several important features related to Excel XLSX creation and manipulation, such as creating Excel workbook, Adding sheets to a workbook, reading Excel documents, creating new cells, adding cell ranges, formatting cells, add and manage rows, create Hyperlinks for a cell, specify compression level, save the file to a Stream and many more.
Getting Started with Simplexcel
The recommended way to install Simplexcel is from NuGet. Please use the following command for a smooth installation.
Install Simplexcel from NuGet
Install-Package Simplexcel
Create Excel Workbook via .NET API
The Simplexcel library enables C# .NET programmers to generate an Excel spreadsheet inside their own .NET apps. You can easily create a workbook and add worksheets, assign a name to it with a couple of lines of .NET code. You can also populate its cells, and add them to a new Workbook with ease. It also supports setting font type and text size for a created sheet.
How to Create Excel Workbook via .NET Library
// using Simplexcel;
var sheet = new Worksheet("Hello, world!");
sheet.Cells[0, 0] = "Hello,";
sheet.Cells["B1"] = "World!";
var workbook = new Workbook();
workbook.Add(sheet);
workbook.Save(@"d:\test.xlsx");
Create Hyperlinks to an Excel Cell
The open source Simplexcel library has provided the capability to create hyperlinks inside an Excel worksheet cell with ease using C# .NET commands. You can easily set your desired format for the hyperlinks. Developers can easily set formatting like bold or font size or border for their worksheet cells.
Add Hyperlinks to Excel Cell via .NET Library
// Just Two lines of code can do it
sheet.Cells["A1"] = "Click me now!";
sheet.Cells["A1"].Hyperlink = "https://github.com/mstum/Simplexcel/";
Add Page Setup Properties for a Worksheet
The open source Simplexcel library enables software developers to set and apply page setup properties for a Worksheet inside their own .NET applications. Page set-up settings affect the way the users see a worksheet. It controls the worksheet features like paper size, page orientation, page headers, and margins, and gridlines.
Apply Page Setup Properties to Spreadsheet File via .NET
var sheet = new Worksheet("Hello, world!");
sheet.PageSetup.PrintRepeatRows = 2; // How many rows (starting with the top one)
sheet.PageSetup.PrintRepeatColumns = 0; // How many columns (starting with the left one, 0 is default)
sheet.PageSetup.Orientation = Orientation.Landscape;
sheet.Cells["A1"] = "Title!";
sheet.Cells["A1"].Bold = true;
sheet.Cells["A2"] = "Subtitle!";
sheet.Cells["A2"].Bold = true;
sheet.Cells["A2"].TextColor = Color.Magenta;
for (int i = 0; i < 100; i++)
{
sheet.Cells[i + 2, 0] = "Entry Number " + (i + 1);
}
Freeze Panes in a worksheet
The open source Simplexcel library has provided the capability for freezing panes in a worksheet using a couple of C# .NET commands. Freeze panes are a very useful feature while working on multiple worksheets, You can keep an area of a worksheet visible while you scroll to another area of the worksheet. At the moment, it is being kept simple; you can either freeze the first row or the leftmost column (A) of a worksheet.
Add Hyperlinks to Excel Cell via .NET Library
// Freeze the first row
Worksheet.FreezeTopRow
// Freeze the leftmost column
Worksheet.FreezeLeftColumn