FakeExcelSerializer 1.1.0
See the version list below for details.
dotnet add package FakeExcelSerializer --version 1.1.0
NuGet\Install-Package FakeExcelSerializer -Version 1.1.0
<PackageReference Include="FakeExcelSerializer" Version="1.1.0" />
<PackageVersion Include="FakeExcelSerializer" Version="1.1.0" />
<PackageReference Include="FakeExcelSerializer" />
paket add FakeExcelSerializer --version 1.1.0
#r "nuget: FakeExcelSerializer, 1.1.0"
#:package FakeExcelSerializer@1.1.0
#addin nuget:?package=FakeExcelSerializer&version=1.1.0
#tool nuget:?package=FakeExcelSerializer&version=1.1.0
FakeExcelSerializer
Convert object to Excel file (.xlsx) [Open XML SpreadsheetML File Format]
Getting Started
Supporting platform is .NET 6.
PM> Install-Package FakeExcelSerializer
Usage
You can use ExcelSerializer.ToFile
.
ExcelSerializer.ToFile(Users, "test.xlsx", ExcelSerializerOptions.Default);
Notice
Folder creation permissions are required since a working folder will be used.
Benchmark
N = 100 lines.
Method | N | Mean | Error | StdDev | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
ClosedXml | 1 | 36.078 ms | 0.3324 ms | 0.3109 ms | 1.00 | 857.1429 | 357.1429 | - | 5,734 KB |
FakeExcelSerializer | 1 | 4.587 ms | 0.0397 ms | 0.0332 ms | 0.13 | 15.6250 | 7.8125 | - | 127 KB |
ClosedXml | 10 | 343.416 ms | 5.7000 ms | 4.7598 ms | 1.00 | 8000.0000 | 1000.0000 | - | 52,661 KB |
FakeExcelSerializer | 10 | 9.067 ms | 0.0850 ms | 0.0709 ms | 0.03 | 93.7500 | 31.2500 | - | 661 KB |
ClosedXml | 100 | 3,663.531 ms | 23.3744 ms | 20.7208 ms | 1.00 | 81000.0000 | 22000.0000 | 5000.0000 | 513,936 KB |
FakeExcelSerializer | 100 | 47.989 ms | 0.9378 ms | 0.8773 ms | 0.01 | 909.0909 | 90.9091 | - | 6,005 KB |
Examples
If you pass an object, it will be converted to an Excel file.
ExcelSerializer.ToFile(new string[] { "test", "test2" }, @"c:\test\test.xlsx", ExcelSerializerOptions.Default);
Passing a class expands the property into a column.
public class Portal
{
public string Name { get; set; }
public string Owner { get; set; }
public int Level { get; set; }
}
var potals = new Portal[] {
new Portal { Name = "Portal1", Owner = "panda728", Level = 8 },
new Portal { Name = "Portal2", Owner = "panda728", Level = 1 },
new Portal { Name = "Portal3", Owner = "panda728", Level = 2 },
};
ExcelSerializer.ToFile(potals, @"c:\test\potals.xlsx", ExcelSerializerOptions.Default);
Options can be set to display a title line and automatically adjust column widths.
var newConfig = ExcelSerializerOptions.Default with
{
CultureInfo = CultureInfo.InvariantCulture,
HasHeaderRecord = true,
HeaderTitles = new string[] { "Name", "Owner", "Level" },
AutoFitColumns = true,
};
ExcelSerializer.ToFile(potals, @"c:\test\potalsOp.xlsx", newConfig);
Note
For the method of retrieving values from IEnumerable<T>, Cysharp's WebSerializer method is used.
https://github.com/Cysharp/WebSerializer
The following page provides information on how to return to OpenOfficeXml.
https://gist.github.com/iso2022jp/721df3095f4df512bfe2327503ea1119
Sample Extensions
WindowsForm's DataGridView to .xlsx
https://github.com/panda728/DataGridViewDump
Link
CSV-like File output version https://github.com/panda728/FakeCsvSerializer
License
This library is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
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.3.4 | 259 | 7/11/2023 |
1.3.3 | 302 | 2/25/2023 |
1.3.2 | 483 | 8/31/2022 |
1.3.1 | 430 | 8/30/2022 |
1.3.0 | 415 | 8/30/2022 |
1.2.1 | 426 | 8/29/2022 |
1.2.0 | 417 | 8/28/2022 |
1.1.0 | 424 | 8/26/2022 |
1.0.3 | 416 | 8/23/2022 |
1.0.2 | 397 | 8/22/2022 |
1.0.1 | 423 | 8/21/2022 |
1.0.0 | 419 | 8/20/2022 |
0.2.0 | 434 | 8/20/2022 |
0.1.0 | 426 | 8/19/2022 |