ExcelFromList 1.6.0

.NET Framework 3.5
Install-Package ExcelFromList -Version 1.6.0
dotnet add package ExcelFromList --version 1.6.0
<PackageReference Include="ExcelFromList" Version="1.6.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExcelFromList --version 1.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ExcelFromList, 1.6.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ExcelFromList as a Cake Addin
#addin nuget:?package=ExcelFromList&version=1.6.0

// Install ExcelFromList as a Cake Tool
#tool nuget:?package=ExcelFromList&version=1.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ExcelFromList

Straightforward and easy way to create stylized excel workbooks from lists. Add an image, title, subtitles and overal cell styles/formats.

You can run these same examples in the Testing project.

With default styles (no style object provided)

var wb = new ExcelWorkBook();
wb.AddSheet("Shelf Life", shelfLifeData);
wb.SaveAs(outputFileName);

Default styles

A style object has been provided for the rest of the examples

With title, subtitles, backdrop color and data background color

var wb = new ExcelWorkBook();
var style = new ExcelStyleConfig
{
      Title = "Product Shelf Life List",
      Subtitles = new string[]
      {
            "As of 2/1/06",
            "Compiled by the Food Bank",
            "From National Manufactures"
      },
      BackdropColor = Color.Lavender,
      DataBackgroundColor = Color.LightGoldenrodYellow
};

wb.AddSheet("Shelf Life", shelfLifeData, style);
wb.SaveAs(outputFileName);

Title and subtitles

With title, subtitles and image from Base64

var wb = new ExcelWorkBook();
var style = new ExcelStyleConfig
{
      Title = "Product Shelf Life List",
      Subtitles = new string[]
      {
            "As of 2/1/06",
            "Compiled by the Food Bank",
            "From National Manufactures"
      },
      TitleImage = new Picture()
      {
            FromBase64 = "iVBORw..."
      }
};

wb.AddSheet("Shelf Life", shelfLifeData, style);
wb.SaveAs(outputFileName);

Title, subtitles and image

With title, subtitles, image from file (sheetOneStyle) and url (sheetTwoStyle), two sheets and cell stylings

var wb = new ExcelWorkBook();
var sheetOneStyle = new ExcelStyleConfig
{
      Title = "Product Shelf Life List",
      Subtitles = new string[]
      {
            "As of 2/1/06",
            "Compiled by the Food Bank",
            "From National Manufactures"
      },
      TitleImage = new Picture()
      {
            FromFile = @"x:\titleImage.jpg"
      }
};
var sheetTwoStyle = new ExcelStyleConfig
{
      Title = "Food Nutrient Information",
      Subtitles = new string[]
      {
            "List of EDNP products",
            "Audited by category"
      },
      TitleImage = new Picture()
      {
            FromUrl = @"http://www.images.com/titleImage.jpg"
      },
      ShowGridLines = false,
      DataBorderAround = true,
      DataBorder = true,
      DataBorderColor = Color.CadetBlue,
      HeaderBackgroundColor = Color.Yellow,
      HeaderFontColor = Color.Black
};

wb.AddSheet("Shelf Life", shelfLifeData, sheetOneStyle);
wb.AddSheet("Food Nutrients", foodInfoData, sheetTwoStyle);
wb.SaveAs(outputFileName);

Title, subtitles, image and two sheets

With title, subtitles, image from Base64, skipping two columns and cell stylings

var wb = new ExcelWorkBook();
var style = new ExcelStyleConfig
{
      Title = "Food Nutrient Information",
      Subtitles = new string[]
      {
            "List of EDNP products",
            "Audited by category"
      },
      TitleImage = new Picture()
      {
            FromBase64 = "iVBORw..."
      },
      ShowGridLines = false,
      DataBorderAround = true,
      DataBorder = true,
      DataBorderColor = Color.CadetBlue,
      HeaderBackgroundColor = Color.Yellow,
      HeaderFontColor = Color.Black,
      ExcludedColumnIndexes = new int[]
      {
            2, 4
      }
};

wb.AddSheet("Food Nutrients", shelfLifeData, style);
wb.SaveAs(outputFileName);

Title, subtitles, image, skipping three rows and cell stylings

Documentation

ExcelStyleConfig class

Sheet configs

ShowHeaders: Enable to show headers (taken from the property name), defaults to true ShowGridLines: Enable to show grid lines, defaults to true AutoFitColumns: Enable to match the width of the column to the data length, defaults to true FreezePanes: Enable to freeze the first row, defaults to true PaddingColumns: Gets or sets the number of columns to insert before column A, defaults to 0 PaddingRows: Gets or sets the number of rows to insert before row 1, defaults to 0 ExcludedColumnIndexes: Gets or sets which columns to exclude by index, range must be between 1 and the total number of columns, defaults to new int[0] UsePropDisplayName: Enable to use the propery DisplayName attribute value, if available, for the column name, defaults to true BackdropColor: Gets or set the backdrop color of the entire sheet, defaults to null

Title configs

Title: Gets or sets the title of the sheet, defaults to null Subtitles: Gets or sets the subtitles of the sheet, defaults to new string[0] TitleImage: Gets or sets an image to be placed on the sheet, defaults to new Picture() ******FromBase64: Gets or sets image from Base64, defaults to null ******FromFile: Gets or sets image from file, defaults to null ******FromUrl: Gets or sets image from url, defaults to null ******HasValue: Indicates if at least one image source has value, defaults to false ******IsValid: Indicates if value is valid, no source or more than one source (false), only one source (true), defaults to false

Data type formatting

DateFormat: Gets or sets custom Excel format string, defaults to m/d/yyyy DecimalFormat: Gets or sets custom Excel format string, defaults to #,##0.00_);[Red]-#,##0.00 DoubleFormat: Gets or sets custom Excel format string, defaults to #,##0.00_);[Red]-#,##0.00 IntFormat: Gets or sets custom Excel format string, defaults to #,##0_);[Red]-#,##0

  • Uses Excel type data formatting

Data cell configs

DataFontColor: Gets or sets data cell font color, defaults to null DataBackgroundColor: Gets or sets data cell background color, defaults to null DataBorder: Enable to draw a border around each data cell, defaults to false DataBorderAround: Enable to draw a border around the data range, defaults to false DataBorderColor: Gets or sets the border color around each data cell, defaults to Color.Black DataBorderAroundColor: Gets or sets the border color around the data range, defaults to Color.Black DataBorderStyle: Gets or sets the border style around each data cell, defaults to ExcelBorderStyle.Thin DataBorderAroundStyle: Gets or sets the border style around the data range, defaults to ExcelBorderStyle.Thin

Header cell configs

HeaderFontColor: Gets or sets the header font color, defaults to Color.LightGray HeaderBackgroundColor: Gets or sets the header background color, defaults to Color.DarkSlateGray HeaderBorder: Enable to draw a border around each header cell, defaults to false HeaderBorderAround: Enable to draw a border around the header range, defaults to false HeaderBorderColor: Gets or sets the border color around each header cell, defaults to Color.Black HeaderBorderAroundColor: Gets or sets the border color around the header range, defaults to Color.Black HeaderBorderStyle: Gets or sets the border style around each header cell, defaults to ExcelBorderStyle.Thin HeaderBorderAroundStyle: Gets or sets the border style around the header range, defaults to ExcelBorderStyle.Thin

ExcelWorkBook class

FullFileName: Gets or sets the full file path for the generated Excel file GetBytesArray(): Returns the ExcelWorkBook bytes array AddSheet(string sheetName): Adds a sheet to the worksheet, will apply style config if provided RemoveSheet(string sheetName): Removes a sheet from the worksheet ClearWorkSheet(): Removes all sheets from worksheet SheetExists(string sheetName): Checks if a specific sheet exists Save(): Saves the workbook to an Excel (FullFileName property must be set) SaveAs(): Saves the workbook to an Excel file Open(): Opens saved Excel file with OS default program

Product Versions
.NET Framework net35 net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.0 738 5/25/2020
1.5.1 245 4/24/2020
1.4.0 345 4/12/2020
1.3.0 314 4/11/2020
1.2.0 341 4/11/2020
1.1.1 299 4/10/2020
1.0.4 266 4/10/2020
1.0.3 352 4/8/2020
1.0.2 295 4/8/2020
1.0.1 346 4/7/2020
1.0.0 271 4/7/2020

Change to version 1.6.0
     Downgraded EPPlus from version 5 to version 4 due to licensing issues