Curiosus.FileDataReaderWriters
2.1.0
dotnet add package Curiosus.FileDataReaderWriters --version 2.1.0
NuGet\Install-Package Curiosus.FileDataReaderWriters -Version 2.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Curiosus.FileDataReaderWriters" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Curiosus.FileDataReaderWriters" Version="2.1.0" />
<PackageReference Include="Curiosus.FileDataReaderWriters" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Curiosus.FileDataReaderWriters --version 2.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Curiosus.FileDataReaderWriters, 2.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Curiosus.FileDataReaderWriters@2.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Curiosus.FileDataReaderWriters&version=2.1.0
#tool nuget:?package=Curiosus.FileDataReaderWriters&version=2.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Curiosus.FileDataReaderWriters
Common contracts for row-by-row reading and writing of tabular files: IFileDataReader, IFileWriter,
cell data and formatting settings, and Excel limits. Code against these interfaces and use
Curiosus.FileDataReaderWriters.Npoi (XLSX) or
Curiosus.FileDataReaderWriters.SylvanCsv (CSV).
Installation
dotnet add package Curiosus.FileDataReaderWriters
Usage
IFileWriter—AddFormat(FormatSettings)/AddDefaultFormat()return a format id;AddHeaders,AppendLine,Append+EndLinewrite rows ofCellData(value, formatId);Flush;Disposefinishes the file.IFileDataReader—Read()moves to the next non-empty row,GetRow()returns its cells (trimmed, empty →null),CurrentRowIdx,MaxSupportedRowsCount.FormatSettings—FontStyle(Bold,Italic),TextAlignment,WrapText,FontSize(default 10),DataFormat(Excel format string, default@).ExcelConstants— row, column and cell length limits of XLS/XLSX.
using Curiosus.FileDataReaderWriters.Readers;
using Curiosus.FileDataReaderWriters.Style;
using Curiosus.FileDataReaderWriters.Writers;
public static class ReportFiles
{
public static void WriteReport(IFileWriter writer, IEnumerable<(string Name, decimal Amount)> rows)
{
var header = writer.AddFormat(new FormatSettings { FontStyle = FontStyle.Bold, TextAlignment = TextAlignment.Center });
writer.AddHeaders(new[] { new CellData("Name", header), new CellData("Amount", header) });
foreach (var (name, amount) in rows)
{
writer.AppendLine(new[] { new CellData(name), new CellData(amount) });
}
}
public static IEnumerable<IReadOnlyList<string?>> ReadAll(IFileDataReader reader)
{
while (reader.Read())
{
// implementations may reuse the row buffer, so copy it if you keep it
yield return reader.GetRow()!.ToArray();
}
}
}
Formats are ignored by writers that do not support them (CSV).
See also
- Curiosus.FileDataReaderWriters.Npoi — XLSX writers (NPOI)
- Curiosus.FileDataReaderWriters.SylvanCsv — CSV reader and writer
- Curiosus.Utils — all packages
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- CsvHelper (>= 33.0.0)
- Curiosus.Localization (>= 2.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
-
net9.0
- CsvHelper (>= 33.0.0)
- Curiosus.Localization (>= 2.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Curiosus.FileDataReaderWriters:
| Package | Downloads |
|---|---|
|
Curiosus.FileDataReaderWriters.Npoi
Npoi realization for working with xls/xlsx/csv files |
|
|
Curiosus.FileDataReaderWriters.SylvanCsv
Sylvan realization for working with csv files |
GitHub repositories
This package is not used by any popular GitHub repositories.