jcoliz.OpenOfficeXml.Serializer
1.0.0
See the version list below for details.
dotnet add package jcoliz.OpenOfficeXml.Serializer --version 1.0.0
NuGet\Install-Package jcoliz.OpenOfficeXml.Serializer -Version 1.0.0
<PackageReference Include="jcoliz.OpenOfficeXml.Serializer" Version="1.0.0" />
paket add jcoliz.OpenOfficeXml.Serializer --version 1.0.0
#r "nuget: jcoliz.OpenOfficeXml.Serializer, 1.0.0"
// Install jcoliz.OpenOfficeXml.Serializer as a Cake Addin #addin nuget:?package=jcoliz.OpenOfficeXml.Serializer&version=1.0.0 // Install jcoliz.OpenOfficeXml.Serializer as a Cake Tool #tool nuget:?package=jcoliz.OpenOfficeXml.Serializer&version=1.0.0
Office Open XML Serializer
This is a .NET Standard 2.1 library designed to make it easy to serialize C# objects from/to Office Open XML spreadsheet documents.
Background
The Office Open XML SDK is very low-level and picky about getting everything just right. I wanted a simpler inferface for my applications which only needed to read and write objects from and to a spreadsheet.
Usage
Namespace
using jcoliz.OpenOfficeXml.Serializer;
Simple Serialization
void WriteToSpreadsheet<T>(Stream stream, IEnumerable<T> items) where T: class
{
using var writer = new SpreadsheetWriter();
writer.Open(stream);
writer.Serialize(items);
}
Simple Deserialization
IEnumerable<T> ReadFromSpreadsheet<T>(Stream stream) where T : class, new()
{
using var reader = new SpreadsheetReader();
reader.Open(stream);
return reader.Deserialize<T>();
}
Sheet Names
Select the sheet name to write into
writer.Serialize(items, "MySheet");
Discover the sheets available in a spreadsheet
foreach(var sheet in reader.SheetNames)
Console.WriteLine(sheet);
Choose which to deserialize from
reader.Deserialize<T>("MySheet")
Exclude Properties on Deserialize
You may want to avoid reading in certain properties. For example, I typically don't want Entity Framework IDs imported from spreadsheets.
var items = reader.Deserialize<T>(exceptproperties: new string[] { "ID" });
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- DocumentFormat.OpenXml (>= 2.13.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.