Shalaby.Convertors.FileConvertorHelpers
1.0.0
dotnet add package Shalaby.Convertors.FileConvertorHelpers --version 1.0.0
NuGet\Install-Package Shalaby.Convertors.FileConvertorHelpers -Version 1.0.0
<PackageReference Include="Shalaby.Convertors.FileConvertorHelpers" Version="1.0.0" />
<PackageVersion Include="Shalaby.Convertors.FileConvertorHelpers" Version="1.0.0" />
<PackageReference Include="Shalaby.Convertors.FileConvertorHelpers" />
paket add Shalaby.Convertors.FileConvertorHelpers --version 1.0.0
#r "nuget: Shalaby.Convertors.FileConvertorHelpers, 1.0.0"
#:package Shalaby.Convertors.FileConvertorHelpers@1.0.0
#addin nuget:?package=Shalaby.Convertors.FileConvertorHelpers&version=1.0.0
#tool nuget:?package=Shalaby.Convertors.FileConvertorHelpers&version=1.0.0
FilesHelpers
FilesHelpers is a lightweight utility library for .NET developers that simplifies exporting data to Excel (.xlsx) and PDF (.pdf) formats. Built using ClosedXML and iTextSharp, it provides elegant exports for both collections and single objects, with out-of-the-box support for Arabic and RTL (Right-to-Left) layouts.
Features
- Export lists (
IEnumerable<T>) to Excel or PDF with custom headers - Export single objects as key-value tables
- Auto-format property names (e.g.
FirstName→FIRST NAME) - PDF supports embedded fonts and RTL (Arabic, Hebrew, etc.)
- Designed for use in ASP.NET Core MVC, Razor Pages, and API responses
- Returns output as
MemoryStream-based DTOs for direct downloads
Installation
Install via NuGet:
dotnet add package FilesHelpers
Or via Package Manager Console:
Install-Package FilesHelpers
Usage Examples
Export a List to Excel
var users = new List<User>
{
new User { Id = 1, Name = "Amr", Email = "amr@example.com" },
new User { Id = 2, Name = "Sara", Email = "sara@example.com" }
};
var columns = new List<(string headerName, string objectPropName)>
{
("User ID", "Id"),
("Full Name", "Name"),
("Email", "Email")
};
var result = FilesHelpers.ExportExcelFile(users, columns, "Users List");
Export a List to PDF (with Arabic font support)
var result = FilesHelpers.ExportPdfFile(env, users, columns, "Users Report");
Ensure you have a font like
Cairo-Regular.ttfinwwwroot/fontsfor Arabic support.
Export a Single Object to PDF (Key-Value Table)
var user = new {
UserName = "Admin",
Email = "admin@example.com",
CreatedAt = DateTime.UtcNow
};
var result = FilesHelpers.ExportObjectToPdf(env, user, "User Details");
Export a Single Object to Excel
var result = FilesHelpers.ExportObjectToExcel(user, "User Info");
DTO Output Format
Both methods return a FileDto:
public record FileDto
{
public MemoryStream FileContent { get; set; }
public string FileName { get; set; }
public string ContentType { get; set; }
}
Use this in a controller to return the file to the browser.
return File(fileDto.FileContent, fileDto.ContentType, fileDto.FileName);
Dependencies
License
This project is licensed under the MIT License.
Author
Amr Shalaby Feel free to contribute, open issues, or suggest improvements.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. |
-
net8.0
- ClosedXML (>= 0.105.0)
- iTextSharp (>= 5.5.13.4)
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.0.0 | 197 | 6/25/2025 |