Table of Contents

Getting Started


Installation

To incorporate SlapKit.Excel into your project, simply add the NuGet package:

dotnet add package SlapKit.Excel

With that done, you're all set to dive in!

Examples

Explore our documentation, where we've gathered hands-on examples inspired by real-world scenarios. These insights could be just the guidance you need!

// Create a workbook document
using XLWorkbook workbook = new XLWorkbook();
IXLWorksheet worksheet = workbook.AddWorksheet();
worksheet.ColumnWidth = 12;

// Insert data
worksheet.Cell("A1").InsertData(new List<object>()
{
    new List<object>() { "Product", "Sold" },
    new List<object>() { "Orange", 14 },
    new List<object>() { "Apple", 6 },
    new List<object>() { "Pear", 10 }
});

// Add 3-D Pie chart
IXLPie3DChart pieChart = worksheet.Charts
    .AddPie3DChart()
    .MoveTo(fromCell: worksheet.Cell("A5"), toCell: worksheet.Cell("E20"));

pieChart.Title.SetText("Sales");

// Set series data
pieChart.Series.Add()
    .SetCategories(worksheet.Range("A2:A4"))
    .SetValues(worksheet.Range("B2:B4"));

workbook.SaveAs("document.xlsx");

pie-chart-500px

* NuGet is a trademark of the Microsoft group of companies.