Create Excels with C# and EPPlus: Miscellaneous
Miscellaneous features
EPPlus can do a whole lot more for you. This post covers some interesting stuff that didn’t really fit anywhere else.
EPPlus can do a whole lot more for you. This post covers some interesting stuff that didn’t really fit anywhere else.
Exporting data to an Excel doesn’t get easier than this
using (var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("IEnumerable");
var data = new[]
{
new {Name = "A", Value = 1},
new {Name = "B", Value = 2},
new {Name = "C", Value = 3},
};
bool generateHeaders = true;
sheet.Cells["A1"].LoadFromCollection(data, generateHeaders);
// Overwrite headers with something fancier
sheet.Cells["A1"].SetHeaders("Name", "Value");
package.SaveAs(new FileInfo(@""));
}
Comparing NSubstitute syntax with Moq, probably the most used mocking framework out there at the moment.
moq/moq4 :
In case your users want to continue working with the Excels after generation.
Not a problem for EPPlus. Instead of calculating values and writing them to an excel, leverage the power of Excel formulas.
Version 4.5.3.3 is the last version of EPPlus you can use without a license for commercial use.
See some alternatives if that is a dealbreaker for you!
A listing of handy but less known shortcuts in Windows Explorer and some Autohotkey examples on how to add extra functionality.
Open Windows Explorer, the most direct way:
My PowerShell, Posh-Git and .gitconfig color configuration because of some red-green troubles with the default configurations.
A cheat sheet with everything there is to know about
formatting the primitive types, DateTime
s and TimeSpan
s in .NET.
Last update on Feb 2, 2025
There vs Their
Last update on Jan 30, 2025
Added ES2024 //v flag (UnicodeSets)
Last update on Sep 14, 2024
Added mongo-secure
Last update on Jul 8, 2024
Added Show-Colors function
Last update on Jun 5, 2024
git filter-repo and Create-PullRequest for Github
Last update on Jun 1, 2024
Update to Angular v18: locale configuration, i18n pipes, updated official doc links etc